Class: Zm::Client::AcesCollection

Inherits:
Base::AccountObjectsCollection show all
Defined in:
lib/zm/client/ace/aces_collection.rb

Overview

collection account aces

Constant Summary

Constants inherited from Base::ObjectsCollection

Base::ObjectsCollection::METHODS_MISSING_LIST

Instance Attribute Summary collapse

Attributes inherited from Base::ObjectsCollection

#parent

Instance Method Summary collapse

Methods inherited from Base::ObjectsCollection

#all, #all!, #find, #first, #logger, #method_missing, #new, #order, #page, #per_page, #respond_to_missing?

Methods included from Inspector

#inspect, #instance_variables_map, #to_h, #to_s

Constructor Details

#initialize(parent) ⇒ AcesCollection

Returns a new instance of AcesCollection.



45
46
47
48
49
50
51
# File 'lib/zm/client/ace/aces_collection.rb', line 45

def initialize(parent)
  super(parent)
  @child_class = Ace
  @builder_class = AcesBuilder
  @jsns_builder = AceJsnsBuilder.new(self)
  reset_query_params
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Zm::Client::Base::ObjectsCollection

Instance Attribute Details

#rightsObject (readonly)

Returns the value of attribute rights.



7
8
9
# File 'lib/zm/client/ace/aces_collection.rb', line 7

def rights
  @rights
end

Instance Method Details

#add(ace) ⇒ Object



41
42
43
# File 'lib/zm/client/ace/aces_collection.rb', line 41

def add(ace)
  @all << ace
end

#create_from_object(item, right) ⇒ Object



35
36
37
38
39
# File 'lib/zm/client/ace/aces_collection.rb', line 35

def create_from_object(item, right)
  ace = new_from_object(item, right)
  add(ace)
  ace
end

#new_from_object(item, right) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/zm/client/ace/aces_collection.rb', line 9

def new_from_object(item, right)
  case item
  when Account
    zid = item.id
    gt = Ace::GT_USER
  when Resource
    zid = item.id
    gt = Ace::GT_USER
  when DistributionList
    zid = item.id
    gt = Ace::GT_GROUP
  when Domain
    zid = item.id
    gt = Ace::GT_DOMAIN
  else
    zid = nil
    gt = nil
  end

  new do |ace|
    ace.zid = zid
    ace.gt = gt
    ace.right = right
  end
end

#where(*rights) ⇒ Object



53
54
55
56
57
# File 'lib/zm/client/ace/aces_collection.rb', line 53

def where(*rights)
  @rights += rights
  @rights.uniq!
  self
end