Commit d8264787 authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review
Browse files

Merge "Bug 1650963: Hide SAML warnings to be hidden if plugin is not active"

parents 9cb6260b 6d0b231f
......@@ -293,6 +293,10 @@ class PluginAuthSaml extends PluginAuth {
return true;
}
public static function is_active() {
return get_field('auth_installed', 'active', 'name', 'saml');
}
public static function has_config() {
return true;
}
......
......@@ -1501,21 +1501,22 @@ function site_warnings() {
$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);
if (PluginAuthSaml::is_active()) {
// 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);
}
}
}
......
Markdown is supported
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