Class: AccessRoles::RoleSetQuery Private
- Inherits:
-
Object
- Object
- AccessRoles::RoleSetQuery
- Includes:
- Enumerable
- Defined in:
- lib/access_roles/role_set_query.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
RoleSet query interface
Instance Attribute Summary collapse
- #role_set ⇒ Object readonly private
Instance Method Summary collapse
- #agent(a) ⇒ Object (also: #group) private
-
#agents ⇒ Array
private
Return the list of agents for the Roles matching the criteria.
- #criteria ⇒ Object private
- #detach ⇒ Object private
- #each(&block) ⇒ Object private
- #in_policy_scope ⇒ Object private
- #in_resource_scope ⇒ Object private
-
#initialize(role_set) ⇒ RoleSetQuery
constructor
private
A new instance of RoleSetQuery.
-
#permissions ⇒ Array<Symbol>
private
Return a list of the permissions granted to the Roles matching the criteria.
- #role_type(r) ⇒ Object (also: #type) private
- #scope(s) ⇒ Object private
- #where(conditions = {}) ⇒ Object private
Constructor Details
#initialize(role_set) ⇒ RoleSetQuery
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of RoleSetQuery.
12 13 14 |
# File 'lib/access_roles/role_set_query.rb', line 12 def initialize(role_set) @role_set = role_set end |
Instance Attribute Details
#role_set ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
10 11 12 |
# File 'lib/access_roles/role_set_query.rb', line 10 def role_set @role_set end |
Instance Method Details
#agent(a) ⇒ Object Also known as: group
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
37 38 39 |
# File 'lib/access_roles/role_set_query.rb', line 37 def agent(a) where(agent: a) end |
#agents ⇒ Array
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return the list of agents for the Roles matching the criteria.
53 54 55 |
# File 'lib/access_roles/role_set_query.rb', line 53 def agents map { |role| role.agent.first } end |
#criteria ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
16 17 18 |
# File 'lib/access_roles/role_set_query.rb', line 16 def criteria @criteria ||= {} end |
#detach ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
63 64 65 |
# File 'lib/access_roles/role_set_query.rb', line 63 def detach DetachedRoleSet.new(self) end |
#each(&block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
47 48 49 |
# File 'lib/access_roles/role_set_query.rb', line 47 def each(&block) role_set.select { |role| matches_all?(role) }.each(&block) end |
#in_policy_scope ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
29 30 31 |
# File 'lib/access_roles/role_set_query.rb', line 29 def in_policy_scope scope(Roles::POLICY_SCOPE) end |
#in_resource_scope ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
33 34 35 |
# File 'lib/access_roles/role_set_query.rb', line 33 def in_resource_scope scope(Roles::RESOURCE_SCOPE) end |
#permissions ⇒ Array<Symbol>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return a list of the permissions granted to the Roles matching the criteria.
59 60 61 |
# File 'lib/access_roles/role_set_query.rb', line 59 def map(&:permissions).flatten.uniq end |
#role_type(r) ⇒ Object Also known as: type
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
42 43 44 |
# File 'lib/access_roles/role_set_query.rb', line 42 def role_type(r) where(role_type: r) end |
#scope(s) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
25 26 27 |
# File 'lib/access_roles/role_set_query.rb', line 25 def scope(s) where(scope: s) end |
#where(conditions = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
20 21 22 23 |
# File 'lib/access_roles/role_set_query.rb', line 20 def where(conditions={}) criteria.merge!(conditions) self end |