function _simplesamlphp_auth_isEnabled in simpleSAMLphp Authentication 7.2
Same name and namespace in other branches
- 6.3 simplesamlphp_auth.module \_simplesamlphp_auth_isEnabled()
- 6.2 simplesamlphp_auth.module \_simplesamlphp_auth_isEnabled()
- 7.3 simplesamlphp_auth.module \_simplesamlphp_auth_isEnabled()
- 7 simplesamlphp_auth.module \_simplesamlphp_auth_isEnabled()
Checks to see if authentication via SimpleSAMLphp should be activated.
Parameters
bool $show_inactive_msg: Whether to display the "module not activated" message
Return value
bool TRUE/FALSE
6 calls to _simplesamlphp_auth_isEnabled()
- simplesamlphp_auth_block_view in ./
simplesamlphp_auth.module - Implements hook_block_view().
- simplesamlphp_auth_form_alter in ./
simplesamlphp_auth.module - Implements hook_form_alter().
- simplesamlphp_auth_init in ./
simplesamlphp_auth.module - Implements hook_init().
- simplesamlphp_auth_loginpage in ./
simplesamlphp_auth.module - The /saml_login which triggers user authentication to SimpleSAMLphp SP.
- simplesamlphp_auth_user_insert in ./
simplesamlphp_auth.module - Implements hook_user_insert().
File
- ./
simplesamlphp_auth.module, line 551 - simpleSAMLphp authentication module for Drupal.
Code
function _simplesamlphp_auth_isEnabled($show_inactive_msg = FALSE) {
global $user;
$failure = NULL;
$is_activated = variable_get('simplesamlphp_auth_activate');
$basedir = variable_get('simplesamlphp_auth_installdir', '/var/simplesamlphp');
if ($is_activated) {
// Make sure we know where SimpleSAMLphp is.
if (!file_exists($basedir)) {
$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()))) {
drupal_set_message($failure);
}
}
return FALSE;
}