Class: Ddr::Auth::Roles::RoleSetQuery Private

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#criteriaObject (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_setObject (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_scopeObject

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_scopeObject

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

#resultObject

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