Scalr_Account_User::isAdmin PHP Method

isAdmin() public method

Checks if the user is admin user (scalr, financial). It means user doesn't have current environment
public isAdmin ( ) : boolean
return boolean
    public function isAdmin()
    {
        return in_array($this->getType(), [self::TYPE_SCALR_ADMIN, self::TYPE_FIN_ADMIN]);
    }

Usage Example

コード例 #1
0
ファイル: Controller.php プロジェクト: rickb838/scalr
 /**
  * Restricts access to controller's actions
  *
  * @return boolean Returns true if user has access.
  */
 public function hasAccess()
 {
     if ($this->user) {
         // check admin, non-admin
         if (!$this->user->isAdmin()) {
             // check controller in permissions
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }