Skip to content

Commit

Permalink
Issue #15: Make sure to respect the 'activated' setting.
Browse files Browse the repository at this point in the history
Fixes #15.
  • Loading branch information
laryn committed May 16, 2023
1 parent ae303fa commit d59fe2f
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions simplesamlphp_auth.module
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ function simplesamlphp_auth_block_info() {
* Checks to see if authentication via SimpleSAMLphp should be activated.
*
* @param bool $show_inactive_msg
* Whether to display the "module not activated" message
* Whether to display the "module not activated" message.
*
* @return bool
* TRUE/FALSE
Expand All @@ -559,19 +559,16 @@ function _simplesamlphp_auth_isEnabled($show_inactive_msg = FALSE) {
$failure = t('SimpleSAMLphp could not be found at %basedir . The simplesamlphp_auth module cannot function until the path to the local SimpleSAMLphp instance is configured.', array('%basedir' => $basedir));
watchdog('simplesamlphp_auth', $failure, NULL, WATCHDOG_WARNING);
}
}

// If there were no failures, then it should be activated.
if (!$failure) {
return TRUE;
}
else {

// Communicate but don't be too annoying.
if ($show_inactive_msg && (1 == $user->uid || user_access('access administration pages')) && (preg_match('/admin\/people/', request_uri()) || preg_match('/admin\/modules/', request_uri()) || preg_match('/admin\/config/', request_uri()))) {
backdrop_set_message($failure);
// If there were no failures, then it should be activated.
if (!$failure) {
return TRUE;
}
}
// If we made it this far, it's not activated.
// Communicate but don't be too annoying.
if ($failure && $show_inactive_msg && (1 == $user->uid || user_access('access administration pages')) && (preg_match('/admin\/people/', request_uri()) || preg_match('/admin\/modules/', request_uri()) || preg_match('/admin\/config/', request_uri()))) {
backdrop_set_message($failure);
}
return FALSE;
}

Expand Down Expand Up @@ -621,9 +618,9 @@ function _simplesamlphp_auth_get_default_name($account) {
) {
throw new Exception(t('There was no set attribute named "%auth_user_name_attr" returned for user %uid.',
array(
'%auth_user_name_attr' => $auth_user_name_attr,
'%uid' => $account,
)));
'%auth_user_name_attr' => $auth_user_name_attr,
'%uid' => $account,
)));
}
$default_name = $_simplesamlphp_auth_saml_attributes[$auth_user_name_attr][0];
}
Expand Down

0 comments on commit d59fe2f

Please sign in to comment.