1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/openstack/models/identity/users.rb
Nelvin Driz e47c5eb9c4 [openstack|identity] Update Fog to Accomodate Tenant Deletion Workaround
Workflow

Signed-off-by: Nelvin Driz <nelvindriz@live.com>
2012-04-30 10:35:02 +08:00

30 lines
744 B
Ruby

require 'fog/core/collection'
require 'fog/openstack/models/identity/user'
module Fog
module Identity
class OpenStack
class Users < Fog::Collection
model Fog::Identity::OpenStack::User
attribute :tenant
def all
tenant_id = tenant.id || nil
load(connection.list_users(tenant_id).body['users'])
end
def find_by_id(id)
self.find {|user| user.id == id} ||
Fog::Identity::OpenStack::User.new(
connection.get_user_by_id(id).body['user'])
end
def destroy(id)
user = self.find_by_id(id)
user.destroy
end
end # class Users
end # class OpenStack
end # module Identity
end # module Fog