mercredi 20 mars 2019

Redirect users if they dont have permission

//If a user does not have access redirect them... This is working fine. However I need to be able to allow an admin user to bypass this block of code and access the page without being redirected.

if($UserPermission->count() == 0){
header("Location:".$us_url_root."index.php?auth=0");
}

// The code below will show true if a user is an admin. If this is true how do I allow them on the page, and also enforce the above redirect code?

if(hasPerm([2],$user->data()->id)){
}

Aucun commentaire:

Enregistrer un commentaire