Class: Ddr::Auth::Roles::RoleSetQuery Private
- Inherits:
-
Object
- Object
- Ddr::Auth::Roles::RoleSetQuery
- Includes:
- Enumerable
- Defined in:
- lib/ddr/auth/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
- #criteria ⇒ Object readonly private
- #role_set ⇒ Object readonly private
Instance Method Summary collapse
- #agent(a) ⇒ Object (also: #group) private
- #in_policy_scope ⇒ Object private
- #in_resource_scope ⇒ Object private
-
#initialize(role_set) ⇒ RoleSetQuery
constructor
private
A new instance of RoleSetQuery.
- #merge(other_query) ⇒ Object private
- #result ⇒ Object private
- #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.
15 16 17 18 |
# File 'lib/ddr/auth/roles/role_set_query.rb', line 15 def initialize(role_set) @role_set = role_set @criteria = {} end |
Instance Attribute Details
#criteria ⇒ 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.
11 12 13 |
# File 'lib/ddr/auth/roles/role_set_query.rb', line 11 def criteria @criteria end |
#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.
11 12 13 |
# File 'lib/ddr/auth/roles/role_set_query.rb', line 11 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/ddr/auth/roles/role_set_query.rb', line 37 def agent(a) where(agent: a) 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/ddr/auth/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/ddr/auth/roles/role_set_query.rb', line 33 def in_resource_scope scope(Roles::RESOURCE_SCOPE) end |
#merge(other_query) ⇒ 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/ddr/auth/roles/role_set_query.rb', line 47 def merge(other_query) where(other_query.criteria) end |
#result ⇒ 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.
51 52 53 54 |
# File 'lib/ddr/auth/roles/role_set_query.rb', line 51 def result matching_roles = role_set.select { |role| matches_all?(role) } RoleSet.new(roles: matching_roles) 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/ddr/auth/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/ddr/auth/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/ddr/auth/roles/role_set_query.rb', line 20 def where(conditions={}) criteria.merge!(conditions) self end |