function onAuthLogout($event) { try { jAcl2::clearCache(); } catch (Exception $e) { } }
/** * set rights on the given forum * @param integer $group the group id. * @param array $rights list of rights key = subject, value = true * @param string $resource the resource corresponding to the "forum" string + id_forum */ public static function setRightsOnForum($group, $rights, $resource) { $dao = jDao::get('jacl2db~jacl2rights', jAcl2Db::getProfile()); $dao->deleteHfnuByGroup($group, $resource); foreach ($rights as $sbj => $val) { if ($val != '') { jAcl2DbManager::addRight($group, $sbj, $resource); } } jAcl2::clearCache(); }
/** * logout a user and delete the user in the php session */ public static function logout() { $config = self::_getConfig(); jEvent::notify('AuthLogout', array('login' => $_SESSION[$config['session_name']]->login)); $_SESSION[$config['session_name']] = new jAuthDummyUser(); try { jAcl::clearCache(); } catch (Exception $e) { } try { jAcl2::clearCache(); } catch (Exception $e) { } if (isset($config['persistant_enable']) && $config['persistant_enable']) { if (!isset($config['persistant_cookie_name'])) { throw new jException('jelix~auth.error.persistant.incorrectconfig', 'persistant_cookie_name, persistant_crypt_key'); } setcookie($config['persistant_cookie_name'] . '[auth]', '', time() - 3600, $config['persistant_cookie_path']); } }
/** * Delete the given subject * @param string $subject the key of the subject */ public static function removeSubject($subject) { $p = jAcl2Db::getProfile(); jDao::get('jelix~jacl2rights', $p)->deleteBySubject($subject); jDao::get('jelix~jacl2subject', $p)->delete($subject); jAcl2::clearCache(); }
/** * Delete the given subject * @param string $subjectGroup the key of the subject group * @since 1.3 */ public static function removeSubjectGroup($subjectGroup) { jDao::get('jacl2db~jacl2subject', 'jacl2_profile')->removeSubjectFromGroup($subjectGroup); jDao::get('jacl2db~jacl2subjectgroup', 'jacl2_profile')->delete($subjectGroup); jAcl2::clearCache(); }
public function testGetRightDisconnect() { jAuth::logout(); jAcl2::clearCache(); $this->assertFalse(jAcl2::check('super.cms.list')); $this->assertFalse(jAcl2::check('admin.access')); jAcl2::clearCache(); jAcl2DbManager::addRight('__anonymous', 'super.cms.list'); $this->assertTrue(jAcl2::check('super.cms.list')); $this->assertFalse(jAcl2::check('admin.access')); jAcl2::clearCache(); }