Module: ChefFixie::AuthzGroupMixin

Includes:
AuthzObjectMixin
Included in:
Sql::Group
Defined in:
lib/chef_fixie/authz_objects.rb

Constant Summary

Constants included from AuthzUtils

ChefFixie::AuthzUtils::ACTIONS, ChefFixie::AuthzUtils::TYPES

Instance Method Summary collapse

Methods included from AuthzObjectMixin

#ace, #ace_add, #ace_add_raw, #ace_delete, #ace_delete_raw, #ace_get_util, #ace_member?, #ace_raw, #acl, #acl_add_from_object, #acl_raw, #authz_api, #authz_delete, #expand_actions, included, #is_authorized, #prefix

Methods included from AuthzUtils

#check_action, #check_actor_or_group, #get_authz_id, #get_type, #resourcify_actor_or_group, #to_resource

Instance Method Details

#groupObject

Todo: filter this by scope and type



263
264
265
# File 'lib/chef_fixie/authz_objects.rb', line 263

def group
  ChefFixie::AuthzMapper.struct_to_name(group_raw)
end

#group_add(entity) ⇒ Object



276
277
278
# File 'lib/chef_fixie/authz_objects.rb', line 276

def group_add(entity)
  group_add_raw(entity.type, entity)
end

#group_add_raw(actor_or_group, entity) ⇒ Object



271
272
273
274
# File 'lib/chef_fixie/authz_objects.rb', line 271

def group_add_raw(actor_or_group, entity)
  entity_resource = to_resource(actor_or_group)
  authz_api.put("#{prefix}/#{entity_resource}/#{entity.authz_id}", {})
end

#group_delete(entity) ⇒ Object



285
286
287
# File 'lib/chef_fixie/authz_objects.rb', line 285

def group_delete(entity)
  group_delete_raw(entity.type, entity)
end

#group_delete_raw(actor_or_group, entity) ⇒ Object



280
281
282
283
# File 'lib/chef_fixie/authz_objects.rb', line 280

def group_delete_raw(actor_or_group, entity)
  entity_resource = to_resource(actor_or_group)
  authz_api.delete("#{prefix}/#{entity_resource}/#{entity.authz_id}")
end

#group_rawObject

Groups need a little more code to manage members.



258
259
260
# File 'lib/chef_fixie/authz_objects.rb', line 258

def group_raw
  authz_api.get("#{prefix}")
end

#listObject



267
268
269
# File 'lib/chef_fixie/authz_objects.rb', line 267

def list
  group
end

#member?(entity) ⇒ Boolean

Returns:

  • (Boolean)


289
290
291
292
# File 'lib/chef_fixie/authz_objects.rb', line 289

def member?(entity)
  members = group_raw
  members[resourcify_actor_or_group(entity.type)].member?(entity.authz_id)
end

#typeObject



253
254
255
# File 'lib/chef_fixie/authz_objects.rb', line 253

def type
  :group
end