nyroFwk  0.2
public.class.php
Go to the documentation of this file.
1 <?php
11 
12  public function isLogged() {
13  return false;
14  }
15 
16  public function login($prm = null, $page = null) {
17  $this->hook('login');
18  return false;
19  }
20 
21  public function logout($prm = null) {
22  $this->hook('logout');
23  return true;
24  }
25 
26  public function addRole($role) {
27  return false;
28  }
29 
30  public function hasRole($role=null) {
31  return false;
32  }
33 
34  public function delRole($role=null) {
35  return true;
36  }
37 
38  public function check(array $url = null, $redirect=true) {
39  if (is_null($url))
40  $url = request::get();
41 
42  $hasRight = !$this->isContained($url, $this->cfg->spec);
43 
44  if (!$hasRight && $redirect) {
45  $request = request::removeLangOutUrl('/'.request::get('request'));
46  if ($request != $this->getPage('forbidden') && $request != $this->getPage('login')) {
47  session::setFlash('nyroError', 'Don\'t have the permission to access to this page.');
48  response::getInstance()->redirect($this->getPage('forbidden', true), 403);
49  }
50  }
51 
52  return $hasRight;
53  }
54 
55  public function getLoginForm(array $prm = array()) {
56  return null;
57  }
58 
59 }
static get($get=null)
login($prm=null, $page=null)
check(array $url=null, $redirect=true)
logout($prm=null)
isContained(array $url, array $checks)
hasRole($role=null)
static setFlash($name, $val=null)
delRole($role=null)
static removeLangOutUrl($request)
static getInstance()
getPage($type='login', $uri=false)
getLoginForm(array $prm=array())
Generated on Sun Oct 15 2017 22:25:20 for nyroFwk by doxygen 1.8.13