Go to the documentation of this file.00001 <?php
00010 abstract class security_abstract extends object {
00011
00012 protected function afterInit() {
00013 foreach($this->cfg->defaultRoles as $role)
00014 $this->addRole($role);
00015 }
00016
00022 abstract public function isLogged();
00023
00031 abstract public function login($prm = null, $page=null);
00032
00039 abstract public function logout($prm = null);
00040
00047 abstract public function addRole($role);
00048
00055 abstract public function hasRole($role=null);
00056
00063 abstract public function delRole($role=null);
00064
00073 abstract public function check(array $url = null, $redirect=true);
00074
00080 abstract public function getLoginForm(array $prm = array());
00081
00088 public function protect($page = null) {
00089 if (!$this->isLogged())
00090 response::getInstance()->redirect(request::uri($page? $page : $this->getPage('forbidden')));
00091 return true;
00092 }
00093
00101 public function getPage($type='login', $uri=false) {
00102 $page = $this->cfg->getInArray('pages', $type);
00103 return $uri? request::uri($page) : $page;
00104 }
00105
00117 protected function hook($name) {}
00118
00126 protected function isContained(array $url, array $checks) {
00127 return utils::isContained($url, $checks);
00128 }
00129
00130 }