function bakery_boot in Bakery Single Sign-On System 7.3
Same name and namespace in other branches
- 6.2 bakery.module \bakery_boot()
- 7.4 bakery.module \bakery_boot()
- 7.2 bakery.module \bakery_boot()
Implements hook_boot().
File
- ./
bakery.module, line 161
Code
function bakery_boot() {
if (drupal_is_cli()) {
return;
}
global $user;
$bakery = bakery_get_bakery();
$cookie = $bakery
->validateSsoCookie($user);
if ($cookie) {
_bakery_handle_sso($cookie);
}
else {
// Invalid SSO cookie so delete and force logout if existing session.
if ($cookie === FALSE) {
$bakery
->deleteSsoCookie();
}
// No cookie or invalid cookie
if (!$cookie && $user->uid > 1) {
// Log out users that have lost their SSO cookie, with the exception of
// UID 1 and any applied roles with permission to bypass.
// This runs for logged in users whom are getting a full bootstrap
// anyways.
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
if (!user_access('bypass bakery')) {
watchdog('bakery', 'Logging out the user with the bad cookie.');
_bakery_user_logout();
}
}
}
}