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/rackspace/models/identity/user.rb
Matt Darby 72e52e70be Revert "Moving Rackspace logic to fog-rackspace"
This reverts commit d6ecb19d24.

Conflicts:
	fog.gemspec
2014-12-10 11:30:34 -05:00

53 lines
1.2 KiB
Ruby

require 'fog/core/model'
module Fog
module Rackspace
class Identity
class User < Fog::Model
identity :id
attribute :username
attribute :password, :alias => 'OS-KSADM:password'
attribute :email
attribute :enabled
attribute :created
attribute :updated
def save
requires :username, :email, :enabled
unless persisted?
data = service.create_user(username, email, enabled, :password => password)
else
data = service.update_user(identity, username, email, enabled, :password => password)
end
merge_attributes(data.body['user'])
true
end
def destroy
requires :identity
service.delete_user(identity)
true
end
def roles
@roles ||= begin
Fog::Rackspace::Identity::Roles.new({
:service => service,
:user => self
})
end
end
def credentials
@credentials ||= begin
Fog::Rackspace::Identity::Credentials.new({
:service => service,
:user => self
})
end
end
end
end
end
end