Class: Chef::ChefFS::FileSystem::AclsDir

Inherits:
BaseFSDir show all
Defined in:
lib/chef/chef_fs/file_system/acls_dir.rb

Constant Summary collapse

ENTITY_TYPES =

we don’t read sandboxes, so we don’t read their acls

%w(clients containers cookbooks data_bags environments groups nodes roles)

Instance Attribute Summary

Attributes inherited from BaseFSObject

#name, #parent, #path

Instance Method Summary collapse

Methods inherited from BaseFSDir

#child, #dir?

Methods inherited from BaseFSObject

#chef_object, #child, #compare_to, #create_child, #delete, #dir?, #exists?, #path_for_printing, #read, #root, #write

Constructor Details

#initialize(parent) ⇒ AclsDir

Returns a new instance of AclsDir.



31
32
33
# File 'lib/chef/chef_fs/file_system/acls_dir.rb', line 31

def initialize(parent)
  super('acls', parent)
end

Instance Method Details

#api_pathObject



39
40
41
# File 'lib/chef/chef_fs/file_system/acls_dir.rb', line 39

def api_path
  parent.api_path
end

#can_have_child?(name, is_dir) ⇒ Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/chef/chef_fs/file_system/acls_dir.rb', line 43

def can_have_child?(name, is_dir)
  is_dir ? ENTITY_TYPES.include(name) : name == 'organization.json'
end

#childrenObject



47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/chef/chef_fs/file_system/acls_dir.rb', line 47

def children
  if @children.nil?
    @children = ENTITY_TYPES.map do |entity_type|
      case entity_type
      when 'cookbooks'
        CookbooksAclDir.new(entity_type, self)
      else
        AclDir.new(entity_type, self)
      end
    end
    @children << AclEntry.new('organization.json', self, true) # the org acl is retrieved as GET /organizations/ORGNAME/ANYTHINGATALL/_acl
  end
  @children
end

#data_handlerObject



35
36
37
# File 'lib/chef/chef_fs/file_system/acls_dir.rb', line 35

def data_handler
  @data_handler ||= Chef::ChefFS::DataHandler::AclDataHandler.new
end

#restObject



62
63
64
# File 'lib/chef/chef_fs/file_system/acls_dir.rb', line 62

def rest
  parent.rest
end