Commit a1fff727 authored by Robert Lyon's avatar Robert Lyon
Browse files

Bug 1579285: Adding warning messages



On admin page for after upgrade to let one know they have to sort out
the saml plugin and any saml instances.

Also clear the old settings for saml plugin when saving config

behatnotneeded

Change-Id: I5ce6e944834510df7581b84b91179cbcb739b9db
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 17fe4478
...@@ -19,7 +19,7 @@ libxml_disable_entity_loader(true); ...@@ -19,7 +19,7 @@ libxml_disable_entity_loader(true);
$path = realpath('../lib'); $path = realpath('../lib');
set_include_path($path . PATH_SEPARATOR . get_include_path()); set_include_path($path . PATH_SEPARATOR . get_include_path());
// calculate the log process nane // calculate the log process name
$LOG_PROCESS = explode('.', $_SERVER['HTTP_HOST']); $LOG_PROCESS = explode('.', $_SERVER['HTTP_HOST']);
$LOG_PROCESS = 'ssphp-' . array_shift($LOG_PROCESS); $LOG_PROCESS = 'ssphp-' . array_shift($LOG_PROCESS);
...@@ -151,8 +151,7 @@ $config = array ( ...@@ -151,8 +151,7 @@ $config = array (
* Options: [syslog,file,errorlog] * Options: [syslog,file,errorlog]
* *
*/ */
'logging.level' => LOG_DEBUG, 'logging.level' => LOG_NOTICE,
//'logging.level' => LOG_INFO,
'logging.handler' => 'file', 'logging.handler' => 'file',
/* /*
......
...@@ -49,10 +49,12 @@ $string['linkaccounts'] = 'Do you want to link remote account %s with local acco ...@@ -49,10 +49,12 @@ $string['linkaccounts'] = 'Do you want to link remote account %s with local acco
$string['loginlink'] = 'Allow users to link own account'; $string['loginlink'] = 'Allow users to link own account';
$string['logintolink'] = 'Local login to %s to link to remote account'; $string['logintolink'] = 'Local login to %s to link to remote account';
$string['logintolinkdesc'] = '<p><b>You are currently connected with remote user %s. Please log in with your local account to link them together or register if you do not currently have an account on %s.</b></p>'; $string['logintolinkdesc'] = '<p><b>You are currently connected with remote user %s. Please log in with your local account to link them together or register if you do not currently have an account on %s.</b></p>';
$string['logo'] = ''; $string['logo'] = 'Logo';
$string['institutionregex'] = 'Do partial string match with institution shortname'; $string['institutionregex'] = 'Do partial string match with institution shortname';
$string['login'] = 'SSO'; $string['login'] = 'SSO';
$string['notusable'] = 'Please install the SimpleSAMLPHP SP libraries'; $string['notusable'] = 'Please install the SimpleSAMLPHP SP libraries';
$string['obsoletesamlplugin'] = 'The auth/saml plugin needs to be reconfigured. Please update the plugin via the <a href="%s">plugin configuration</a> form.';
$string['obsoletesamlinstance'] = 'The SAML authentication instance <a href="%s">%s</a> for the "%s" institution needs updating.';
$string['reallyreallysure'] = "You are trying to save the SP metadata for Mahara - this cannot be undone and existing institution configured SAML logins will not work until you have reshared your new metadata with all IdPs"; $string['reallyreallysure'] = "You are trying to save the SP metadata for Mahara - this cannot be undone and existing institution configured SAML logins will not work until you have reshared your new metadata with all IdPs";
$string['reset'] = 'Reset Metadata'; $string['reset'] = 'Reset Metadata';
$string['resetmetadata'] = 'Reset the certificates for Maharas metadata - caution this cannot be undone and you will have to reshare your metadata with the IdP'; $string['resetmetadata'] = 'Reset the certificates for Maharas metadata - caution this cannot be undone and you will have to reshare your metadata with the IdP';
......
...@@ -475,6 +475,7 @@ class PluginAuthSaml extends PluginAuth { ...@@ -475,6 +475,7 @@ class PluginAuthSaml extends PluginAuth {
} }
public static function save_config_options(Pieform $form, $values) { public static function save_config_options(Pieform $form, $values) {
delete_records('auth_config', 'plugin', 'saml');
$configs = array('spentityid'); $configs = array('spentityid');
foreach ($configs as $config) { foreach ($configs as $config) {
set_config_plugin('auth', 'saml', $config, $values[$config]); set_config_plugin('auth', 'saml', $config, $values[$config]);
......
...@@ -1492,6 +1492,24 @@ function site_warnings() { ...@@ -1492,6 +1492,24 @@ function site_warnings() {
$warnings[] = get_string('noreplyaddressmissingorinvalid', 'error', get_config('wwwroot') . 'admin/site/options.php?fs=emailsettings'); $warnings[] = get_string('noreplyaddressmissingorinvalid', 'error', get_config('wwwroot') . 'admin/site/options.php?fs=emailsettings');
} }
// Check if the saml plugin config needs updating
if (record_exists_select('auth_config', "plugin = ? AND field = ?", array('saml', 'simplesamlphplib'))) {
$warnings[] = get_string('obsoletesamlplugin', 'auth.saml', get_config('wwwroot') . 'admin/extensions/pluginconfig.php?plugintype=auth&pluginname=saml');
}
// Check if all saml instances are configured for new auth/saml plugin.
if ($samls = get_records_sql_array(
"SELECT ai.id, ai.instancename, i.name, i.displayname FROM {auth_instance} ai
LEFT JOIN {institution} i ON i.name = ai.institution
WHERE ai.id NOT IN (
SELECT instance FROM {auth_instance_config} aic
WHERE aic.field = ?
) AND ai.authname = ?", array('institutionidpentityid', 'saml'))) {
foreach ($samls as $saml) {
$warnings[] = get_string('obsoletesamlinstance', 'auth.saml', get_config('wwwroot') . 'admin/users/addauthority.php?id=' . $saml->id . '&edit=1&i=' . $saml->name . '&p=saml', $saml->instancename, $saml->displayname);
}
}
// Check that the GD library has support for jpg, png and gif at least // Check that the GD library has support for jpg, png and gif at least
$gdinfo = gd_info(); $gdinfo = gd_info();
if (!$gdinfo['JPEG Support']) { if (!$gdinfo['JPEG Support']) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment