Class: Chef::ChefFS::DataHandler::AclDataHandler

Inherits:
DataHandlerBase show all
Defined in:
lib/chef/chef_fs/data_handler/acl_data_handler.rb

Instance Method Summary collapse

Methods inherited from DataHandlerBase

#chef_class, #chef_object, #default, #from_ruby, #minimize, #normalize_for_post, #normalize_for_put, #normalize_hash, #normalize_run_list, #preserve_key?, #remove_file_extension, #to_ruby, #to_ruby_keys, #verify_integrity

Instance Method Details

#normalize(acl, entry) ⇒ Object


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/chef/chef_fs/data_handler/acl_data_handler.rb', line 7

def normalize(acl, entry)
  # Normalize the order of the keys for easier reading
  result = normalize_hash(acl, {
    "create" => {},
    "read" => {},
    "update" => {},
    "delete" => {},
    "grant" => {},
    })
  result.keys.each do |key|
    result[key] = normalize_hash(result[key], { "actors" => [], "groups" => [] })
    result[key]["actors"] = result[key]["actors"].sort
    result[key]["groups"] = result[key]["groups"].sort
  end
  result
end