Class: Mumukit::Auth::Role
- Inherits:
-
Object
- Object
- Mumukit::Auth::Role
- Defined in:
- lib/mumukit/auth/role.rb
Direct Known Subclasses
Admin, Editor, Headmaster, Janitor, Moderator, Owner, Student, Teacher, Writer
Defined Under Namespace
Classes: Admin, Editor, Headmaster, Janitor, Moderator, Owner, Student, Teacher, Writer
Instance Method Summary collapse
- #allows?(resource_slug, permissions) ⇒ Boolean
-
#initialize(symbol) ⇒ Role
constructor
A new instance of Role.
- #parent_allows?(resource_slug, permissions) ⇒ Boolean
- #to_sym ⇒ Object
Constructor Details
#initialize(symbol) ⇒ Role
Returns a new instance of Role.
3 4 5 |
# File 'lib/mumukit/auth/role.rb', line 3 def initialize(symbol) @symbol=symbol end |
Instance Method Details
#allows?(resource_slug, permissions) ⇒ Boolean
7 8 9 10 |
# File 'lib/mumukit/auth/role.rb', line 7 def allows?(resource_slug, ) .role_allows?(to_sym, resource_slug) || parent_allows?(resource_slug, ) end |
#parent_allows?(resource_slug, permissions) ⇒ Boolean
12 13 14 |
# File 'lib/mumukit/auth/role.rb', line 12 def parent_allows?(resource_slug, ) parent.allows?(resource_slug, ) end |
#to_sym ⇒ Object
16 17 18 |
# File 'lib/mumukit/auth/role.rb', line 16 def to_sym @symbol end |