Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #15: Make sure to respect the 'activated' setting. #16

Merged
merged 1 commit into from
May 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 12 additions & 15 deletions simplesamlphp_auth.module
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,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 @@ -554,19 +554,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 @@ -616,9 +613,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