Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Proposal/Request] Requesting role helper methods #2

Closed
spaceemotion opened this issue Dec 21, 2013 · 3 comments
Closed

[Proposal/Request] Requesting role helper methods #2

spaceemotion opened this issue Dec 21, 2013 · 3 comments
Assignees
Milestone

Comments

@spaceemotion
Copy link

This is a request for the following role helper methods:

  • User::is(array $roles) Checks if the user belongs to all the defined roles: $user->is(['moderator‘, 'editor']);
  • User::isNot(array $roles) Checks if the user does not belong to all the defined roles: $user->isNot(['moderator‘, 'editor']);
  • User::isOneOf(array $roles) Checks if the user belongs to at least one of the defined roles: $user->isOneOf(['moderator‘, 'editor']);
  • User::isNoneOf(array $roles) Checks if the user does not belong to at least one of the defined roles: $user->isNoneOf(['moderator‘, 'editor']);

Side Note: For the developers that still require 5.3 and hence have no access to the new array syntax a shorted version for each of the listed functions above would be appreciated (User::is(String $role) -> return $this->is(array($role));).

@ghost ghost assigned crynobone Dec 21, 2013
@ahmadshah
Copy link
Contributor

+1 for the helpers

@spaceemotion
Copy link
Author

maybe it could be even changed to mixed $var - so it could either be a role object, a string or an array of strings or role objects ...

just a thought.

@crynobone
Copy link
Member

Added via #6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants