/**
  * @inheritdoc
  */
 public function execute(User $user, Resource $resource = null)
 {
     if (!$user instanceof LatticeUser) {
         throw new \Exception("User should be of lattice type");
     }
     return $user->permission()->level() > 5;
 }
 /**
  * @param string $id
  * @param Roles $roles
  */
 public function __construct($id, Roles $roles)
 {
     parent::__construct($id);
     $this->roles = $roles;
 }
 /**
  * @inheritdoc
  */
 public function execute(User $user, Resource $resource = null)
 {
     return $user->id() == 1;
 }
 /**
  * @param string     $id
  * @param Permission $permission
  */
 public function __construct($id, Permission $permission)
 {
     parent::__construct($id);
     $this->permission = $permission;
 }
 /**
  * @param User $user
  *
  * @throws SecurityAccessDenied
  */
 private function userHasNoAccess(User $user)
 {
     throw new SecurityAccessDenied("User of id {$user->id()} have no access to this resource.");
 }