Skip to content

Commit

Permalink
Revert "re #186: Add UserAbstract::hasRole and UserAbstract::hasRoles"
Browse files Browse the repository at this point in the history
This reverts commit 9f94a67.
  • Loading branch information
ercanozkaya committed Dec 19, 2014
1 parent b12c431 commit 18c5ceb
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions code/libraries/koowa/libraries/user/abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,30 +126,6 @@ public function getRoles()
return KObjectConfig::unbox($this->getData()->roles);
}

/**
* Checks if the user has a role.
*
* @param mixed|array $roles A role name or an array containing role identifiers.
* @return bool True if the user has at least one of the provided roles, false otherwise.
*/
public function hasRole($roles)
{
$roles = (array) $roles;
return (bool) array_intersect($this->getRoles(), $roles);
}

/**
* Checks if the user has a set of roles.
*
* @param array $roles An array containing role identifiers.
* @return bool True if the user has all of the provided roles, false otherwise.
*/
public function hasRoles($roles)
{
$roles = (array) $roles;
return count(array_intersect(array_unique($this->getRoles()), $roles)) === count($roles);
}

/**
* Returns the groups the user is part of
*
Expand Down

0 comments on commit 18c5ceb

Please sign in to comment.