function _simplesamlphp_auth_isEnabled in simpleSAMLphp Authentication 6.2
Same name and namespace in other branches
- 6.3 simplesamlphp_auth.module \_simplesamlphp_auth_isEnabled()
- 7.3 simplesamlphp_auth.module \_simplesamlphp_auth_isEnabled()
- 7 simplesamlphp_auth.module \_simplesamlphp_auth_isEnabled()
- 7.2 simplesamlphp_auth.module \_simplesamlphp_auth_isEnabled()
Checks to see if authentication via SimpleSAMLphp should be activated
Parameters
bShowInactiveMsg: Whether to display the "module not activated" message
Return value
TRUE/FALSE
5 calls to _simplesamlphp_auth_isEnabled()
- simplesamlphp_auth_block in ./
simplesamlphp_auth.module - Implementation of hook_block().
- simplesamlphp_auth_form_alter in ./
simplesamlphp_auth.module - Implementation of hook_form_alter().
- simplesamlphp_auth_init in ./
simplesamlphp_auth.module - Implementation of hook_init().
- simplesamlphp_auth_loginpage in ./
simplesamlphp_auth.module - Represents the Drupal page (saml_login), which triggers user authentication against the SimpleSAMLphp service provider.
- _simplesamlphp_auth_generate_block_text in ./
simplesamlphp_auth.module - Generates the text for the log in block.
File
- ./
simplesamlphp_auth.module, line 571 - simpleSAMLphp authentication module for Drupal.
Code
function _simplesamlphp_auth_isEnabled($bShowInactiveMsg = FALSE) {
global $user;
$failure = NULL;
$isActivated = variable_get('simplesamlphp_auth_activate', FALSE);
$basedir = variable_get('simplesamlphp_auth_installdir', '/var/simplesamlphp');
if (!$isActivated) {
$menuPaths = array_keys(simplesamlphp_auth_menu());
$failure = t('SimpleSAMLphp authentication is NOT yet activated. It can be activated on the ' . l(t('configuration page'), $menuPaths[0]) . '.');
watchdog('simplesamlphp_auth', $failure, NULL, WATCHDOG_WARNING);
}
else {
// 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 ($bShowInactiveMsg && user_access('access administration pages') && (preg_match('/\\/admin\\/user/', request_uri()) || preg_match('/\\/admin\\/build\\/modules/', request_uri()))) {
drupal_set_message($failure);
}
}
return FALSE;
}