Example #1
0
 /**
  * Checks whether the user has a role.
  *
  * @param Role $role
  *
  * @return bool
  */
 public function hasRole(Role $role)
 {
     foreach ($this->getRoles() as $storedRole) {
         if ($storedRole->getRole() === $role->getRole()) {
             return true;
         }
     }
     return false;
 }
 /**
  * @Then I should get the :arg1 role
  */
 public function checkRole($arg1)
 {
     Assertion::eq($this->resultRole->getRole(), $arg1);
 }
Example #3
0
 /**
  * Checks whether the user has a role.
  *
  * @param Role $role
  *
  * @return bool
  */
 public function hasRole(Role $role) : bool
 {
     return $this->roles->exists(function (int $index, Role $userRole) use($role) {
         return $role->getRole() === $userRole->getRole();
     });
 }