Class: Mumukit::Auth::Role
- Inherits:
-
Object
- Object
- Mumukit::Auth::Role
show all
- Defined in:
- lib/mumukit/auth/role.rb
Defined Under Namespace
Classes: Editor, Headmaster, Janitor, Moderator, Owner, Student, Teacher, Writer
Instance Method Summary
collapse
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, permissions)
permissions.role_allows?(to_sym, resource_slug) ||
parent_allows?(resource_slug, permissions)
end
|
#parent_allows?(resource_slug, permissions) ⇒ Boolean
12
13
14
|
# File 'lib/mumukit/auth/role.rb', line 12
def parent_allows?(resource_slug, permissions)
parent.allows?(resource_slug, permissions)
end
|
#to_sym ⇒ Object
16
17
18
|
# File 'lib/mumukit/auth/role.rb', line 16
def to_sym
@symbol
end
|