Class: Alberich::Role
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Alberich::Role
- Defined in:
- app/models/alberich/role.rb
Constant Summary collapse
- VALID_SCOPES =
["Alberich::BasePermissionObject"] + Alberich.
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.all_by_scope ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'app/models/alberich/role.rb', line 25 def self.all_by_scope roles = self.all role_hash = {} roles.each do |role| role_hash[role.scope] ||= [] role_hash[role.scope] << role end role_hash end |
Instance Method Details
#privilege_target_match(obj_type) ⇒ Object
21 22 23 |
# File 'app/models/alberich/role.rb', line 21 def privilege_target_match(obj_type) (privilege_target_types & obj_type.active_privilege_target_types).any? end |
#privilege_target_types ⇒ Object
18 19 20 |
# File 'app/models/alberich/role.rb', line 18 def privilege_target_types privileges.collect {|x| x.target_type.constantize}.uniq end |