Newscoop\Entity\User\Staff::hasPermission PHP Method

hasPermission() public method

Check permissions
public hasPermission ( string $permission, $resource = null, $action = null ) : boolean
$permission string
return boolean
    public function hasPermission($permission, $resource = null, $action = null)
    {
        $acl = Zend_Registry::get('acl')->getAcl($this);
        try {
            list($resource, $action) = PermissionToAcl::translate($permission);
            if ($acl->isAllowed($this, strtolower($resource), strtolower($action))) {
                return true;
            } else {
                return false;
            }
        } catch (Exception $e) {
            return false;
        }
    }

Usage Example

 public function hasPermission($permission)
 {
     $this->__load();
     return parent::hasPermission($permission);
 }