Use role constants for roles
This commit is contained in:
parent
d0b38d17b1
commit
6bd36d6623
3 changed files with 4 additions and 4 deletions
|
@ -125,7 +125,7 @@ class Auth
|
|||
|
||||
|
||||
/**
|
||||
* Check if current user has a certain role
|
||||
* Check if current user has a certain role, but User::ROLE_ADMIN will have access to all
|
||||
*
|
||||
* @param string $requiredRole
|
||||
*
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
<a href="<?php echo url('private'); ?>">[Personal Dashboard]</a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if(Auth::hasPermission('user')): ?>
|
||||
<?php if(Auth::isLoggedIn()): ?>
|
||||
<div class="header-button">
|
||||
Logged in as <?php echo Auth::getUser()->getEmail(); ?>
|
||||
<a href="<?php echo url('logout'); ?>">[Logout]</a>
|
||||
|
|
|
@ -31,7 +31,7 @@ function load_page($p){
|
|||
|
||||
if(preg_match("/^\/private(.*)$/", $p) == 1){
|
||||
// Page is user page
|
||||
if(Auth::hasPermission('user')){
|
||||
if(Auth::hasPermission(User::ROLE_USER)){
|
||||
switch($p){
|
||||
case "/private/":
|
||||
return "include/php/pages/private/start.php";
|
||||
|
@ -48,7 +48,7 @@ function load_page($p){
|
|||
|
||||
else if(preg_match("/^\/admin(.*)$/", $p) == 1){
|
||||
// Page is admin page
|
||||
if(Auth::hasPermission('admin')){
|
||||
if(Auth::hasPermission(User::ROLE_ADMIN)){
|
||||
switch($p){
|
||||
case "/admin/":
|
||||
return "include/php/pages/admin/start.php";
|
||||
|
|
Loading…
Add table
Reference in a new issue