function simple_ldap_configuration_errors in Simple LDAP 7.2
Same name and namespace in other branches
- 7 simple_ldap_sso/simple_ldap_sso.inc \simple_ldap_configuration_errors()
Return an array of not configuration errors.
For use in hook_requirements() and simple_ldap_sso_configured().
2 calls to simple_ldap_configuration_errors()
- simple_ldap_sso_configured in simple_ldap_sso/
simple_ldap_sso.inc - Check to make sure this module is configured properly.
- simple_ldap_sso_requirements in simple_ldap_sso/
simple_ldap_sso.install - Implements hook_requirements().
File
- simple_ldap_sso/
simple_ldap_sso.inc, line 29 - Simple LDAP SSO API functions.
Code
function simple_ldap_configuration_errors() {
$errors = array();
// We need the module files here in order to call these functions.
drupal_load('module', 'simple_ldap');
drupal_load('module', 'simple_ldap_user');
/*
if (!simple_ldap_configured() || !simple_ldap_user_configured()) {
$errors = t('Simple LDAP and Simple LDAP User modules must be configured.');
}
*/
// Ensure the encryption key is set.
if (!variable_get('simple_ldap_sso_encryption_key')) {
$errors[] = t('You must specify an encryption key.');
}
// Check the readonly variable.
if (variable_get('simple_ldap_readonly') && (!variable_get('simple_ldap_sso_binddn') || !variable_get('simple_ldap_sso_bindpw'))) {
$errors[] = t('This site is in read only mode, so you must specify separate LDAP credentials with read/write access.');
}
// Ensure the attribute sid is set.
if (!variable_get('simple_ldap_sso_attribute_sid')) {
$errors[] = t('You must specify the LDAP attribute used to store the hashed session id.');
}
// Ensure the session_inc variable is set properly. We can't use
// drupal_get_path here, because it's not loaded yet when this gets called
// from the session include. Granted, it wouldn't be called from the session
// include unless this particular bit was configured properly, but we leave
// this in so that it works for hook_requirements().
$session_inc_path = __DIR__ . '/simple_ldap_sso.session.inc';
if (DRUPAL_ROOT . '/' . variable_get('session_inc') != $session_inc_path) {
$errors[] = t('You must set the session_inc variable to Simple LDAP SSO’s session include file.');
}
// Ensure mcrypt is available.
if (!extension_loaded('mcrypt')) {
$t_args['@url'] = 'http://php.net/mcrypt';
$errors[] = t('You must have the <a href="@url">PHP mcrypt extension</a> installed.', $t_args);
}
return $errors;
}