Class: Pebblebed::Security::AccessData
- Inherits:
-
Object
- Object
- Pebblebed::Security::AccessData
- Defined in:
- lib/pebblebed/security/access_data.rb
Instance Attribute Summary collapse
-
#group_ids ⇒ Object
readonly
Returns the value of attribute group_ids.
Instance Method Summary collapse
-
#initialize(data) ⇒ AccessData
constructor
A new instance of AccessData.
-
#relevant_subtrees(wildcard_path) ⇒ Object
Takes a path (possibly with wildcards) and returns any subtrees that are relevant to determine accessibility to restricted content in a query of documents in that wildcard_path.
- #subtrees ⇒ Object
Constructor Details
#initialize(data) ⇒ AccessData
Returns a new instance of AccessData.
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/pebblebed/security/access_data.rb', line 7 def initialize(data) if data[:subtrees] || data[:group_ids] @group_ids = Set.new(data[:group_ids]) @subtrees = Set.new data[:subtrees].each do |subtree| @subtrees << subtree.split('.') end else # Assume this is a /identities/:id/memberships result from checkpoint parse_checkpoint_record(data) end end |
Instance Attribute Details
#group_ids ⇒ Object (readonly)
Returns the value of attribute group_ids.
5 6 7 |
# File 'lib/pebblebed/security/access_data.rb', line 5 def group_ids @group_ids end |
Instance Method Details
#relevant_subtrees(wildcard_path) ⇒ Object
Takes a path (possibly with wildcards) and returns any subtrees that are relevant to determine accessibility to restricted content in a query of documents in that wildcard_path. All relevant subtrees are guaranteed to be returned, but not all returned subtrees are guaranteed to be relevant. I.e. some irrelevant subtrees may be returned. (If the path does not use wildcards, relevance is guaranteed.)
28 29 30 31 |
# File 'lib/pebblebed/security/access_data.rb', line 28 def relevant_subtrees(wildcard_path) pristine = self.class.pristine_path(wildcard_path) intersecting_subtrees(pristine) end |
#subtrees ⇒ Object
33 34 35 |
# File 'lib/pebblebed/security/access_data.rb', line 33 def subtrees @subtrees.map { |subtree| subtree.join('.') } end |