function ldap_sso_path_excluded_from_sso in LDAP Single Sign On 7.2
Paths excluded from SSO.
1 call to ldap_sso_path_excluded_from_sso()
- ldap_sso_boot in ./
ldap_sso.module - Implements hook_boot().
File
- ./
ldap_sso.module, line 116 - This module injects itself into Drupal's Authentication stack.
Code
function ldap_sso_path_excluded_from_sso($path = FALSE) {
module_load_include('module', 'ldap_servers');
$result = FALSE;
if ($path) {
// Don't derive.
}
elseif (ldap_servers_get_globals('_SERVER', 'PHP_SELF') == '/index.php') {
$path = $_GET['q'];
}
else {
// Cron.php, etc.
$path = ltrim(ldap_servers_get_globals('_SERVER', 'PHP_SELF'), '/');
}
if (in_array($path, ldap_sso_default_excluded_paths())) {
return TRUE;
}
$ldap_authentication_conf = variable_get('ldap_authentication_conf', array());
if (isset($ldap_authentication_conf['ssoExcludedHosts']) && is_array($ldap_authentication_conf['ssoExcludedHosts'])) {
$host = ldap_servers_get_globals('_SERVER', 'SERVER_NAME');
foreach ($ldap_authentication_conf['ssoExcludedHosts'] as $host_to_check) {
if ($host_to_check == $host) {
return TRUE;
}
}
}
if (isset($ldap_authentication_conf['ssoExcludedPaths'])) {
$patterns = implode("\r\n", $ldap_authentication_conf['ssoExcludedPaths']);
if ($patterns) {
if (function_exists('drupal_get_path_alias')) {
$path = drupal_get_path_alias($path);
}
$path = function_exists('drupal_strtolower') ? drupal_strtolower($path) : strtolower($path);
$to_replace = array(
// Newlines.
'/(\\r\\n?|\\n)/',
// Asterisks.
'/\\\\\\*/',
// <front>.
'/(^|\\|)\\\\<front\\\\>($|\\|)/',
);
$replacements = array(
'|',
'.*',
'\\1' . preg_quote(variable_get('site_frontpage', 'node'), '/') . '\\2',
);
$patterns_quoted = preg_quote($patterns, '/');
$regex = '/^(' . preg_replace($to_replace, $replacements, $patterns_quoted) . ')$/';
$result = (bool) preg_match($regex, $path);
}
}
return $result;
}