Module: Permissify::Roles
- Includes:
- Union
- Defined in:
- lib/permissify/roles.rb
Instance Method Summary collapse
-
#primary_domain_type ⇒ Object
NOTE: in example app, helper methods enforce only assigning domain_type-specific roles to users (an brand user can only be asigned roles that have a domain type of Brand).
Methods included from Union
Methods included from Common
#allowed_to?, #createable?, #deleteable?, #log_permissions, #permissible?, #subscribed_to?, #updateable?, #viewable?
Instance Method Details
#primary_domain_type ⇒ Object
NOTE: in example app, helper methods enforce only assigning domain_type-specific roles to users
(an brand user can only be asigned roles that have a domain type of Brand).
12 13 14 15 16 17 18 19 20 |
# File 'lib/permissify/roles.rb', line 12 def primary_domain_type return nil if roles.empty? domain_types = roles.collect(&:domain_type) ranked_domain_types = roles.first.class::DOMAIN_TYPES ranked_domain_types.each do |ranked_domain_type| return ranked_domain_type if domain_types.include?(ranked_domain_type) end nil # unrecognized domain_type value(s) end |