parent
4870dc04b2
commit
9eeaabc6fe
364 changed files with 51722 additions and 987 deletions
|
|
@ -72,10 +72,23 @@ class Controller extends \b8\Controller
|
|||
return $this->response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Require that the currently logged in user is an administrator.
|
||||
* @throws ForbiddenException
|
||||
*/
|
||||
protected function requireAdmin()
|
||||
{
|
||||
if (!$_SESSION['phpci_user']->getIsAdmin()) {
|
||||
if (!$this->currentUserIsAdmin()) {
|
||||
throw new ForbiddenException('You do not have permission to do that.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the currently logged in user is an administrator.
|
||||
* @return bool
|
||||
*/
|
||||
protected function currentUserIsAdmin()
|
||||
{
|
||||
return $_SESSION['phpci_user']->getIsAdmin();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue