function _simplesamlphp_auth_isEnabled in simpleSAMLphp Authentication 7.3
Same name and namespace in other branches
- 6.3 simplesamlphp_auth.module \_simplesamlphp_auth_isEnabled()
- 6.2 simplesamlphp_auth.module \_simplesamlphp_auth_isEnabled()
- 7 simplesamlphp_auth.module \_simplesamlphp_auth_isEnabled()
- 7.2 simplesamlphp_auth.module \_simplesamlphp_auth_isEnabled()
Checks if authentication via SimpleSAMLphp should be activated.
Parameters
bool $show_inactive_msg: Whether to display the "module not activated" message
Return value
bool TRUE if simplesamlphp_auth is enabled.
3 calls to _simplesamlphp_auth_isEnabled()
- simplesamlphp_auth_form_alter in ./
simplesamlphp_auth.module - Implements hook_form_alter().
- _simplesamlphp_auth_generate_block_text in ./
simplesamlphp_auth.module - Generates the text for the log in block.
- _simplesaml_auth_autoload in ./
simplesamlphp_auth.module - Loads simplesamlphp class and initializes global variables.
1 string reference to '_simplesamlphp_auth_isEnabled'
- simplesamlphp_auth_menu in ./
simplesamlphp_auth.module - Implements hook_menu().
File
- ./
simplesamlphp_auth.module, line 414 - 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', '/usr/share/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);
}
}
else {
$failure = t('SimpleSAMLphp auth is not yet activated.');
}
// 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;
}