Module: Faalis::Concerns::User::UserRoles
- Included in:
- User
- Defined in:
- app/models/faalis/concerns/user/user_roles.rb
Instance Method Summary collapse
-
#admin? ⇒ Boolean
A shortcut for ‘role? :admin`.
- #role?(role) ⇒ Boolean
-
#roles ⇒ Object
Return an array of user roles.
Instance Method Details
#admin? ⇒ Boolean
A shortcut for ‘role? :admin`
18 19 20 |
# File 'app/models/faalis/concerns/user/user_roles.rb', line 18 def admin? role? :admin end |
#role?(role) ⇒ Boolean
13 14 15 |
# File 'app/models/faalis/concerns/user/user_roles.rb', line 13 def role? role roles.include? role.to_s end |
#roles ⇒ Object
Return an array of user roles.
9 10 11 |
# File 'app/models/faalis/concerns/user/user_roles.rb', line 9 def roles self.groups.to_a.map(&:role) end |