/** * Check if the current logged-in user is master administrator or not */ function auth_isMaster() { global $_auth; if (auth_isAnonymous()) { return false; } if ($_auth & $_auth->isMaster) { return true; } return false; }
<?php if (auth_isAnonymous()) { flash_set(_t('Your session is expired.'), '', 'error'); _redirect('admin/login'); } $timestamp = _arg(2); if ($timestamp) { if ($timestamp == $_auth->timestamp) { # Normal logout process auth_clear(); flash_set(_t('You have signed out successfully.')); _redirect('admin/login'); } }
/** * Check if the authenticate user is blocked for a particular permission * This function is overwritable from the custom helpers/auth_helper.php * @param string $perm The permission key * @return boolean */ function auth_block($perm) { if (auth_isAnonymous()) { return true; } $sess = auth_get(); if (in_array($perm, $sess->blocks)) { return true; } return false; }