mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Merge pull request #3760 from seanhandley/tenant_not_required
[OpenStack] Users can be created without a tenant ID or password
This commit is contained in:
commit
0351e96aa8
1 changed files with 6 additions and 2 deletions
|
@ -22,7 +22,7 @@ module Fog
|
|||
|
||||
def save
|
||||
raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted?
|
||||
requires :name, :tenant_id, :password
|
||||
requires :name
|
||||
enabled = true if enabled.nil?
|
||||
data = service.create_user(name, password, email, tenant_id, enabled)
|
||||
merge_attributes(data.body['user'])
|
||||
|
@ -56,7 +56,11 @@ module Fog
|
|||
end
|
||||
|
||||
def roles(tenant_id = self.tenant_id)
|
||||
service.list_roles_for_user_on_tenant(tenant_id, self.id).body['roles']
|
||||
if tenant_id
|
||||
service.list_roles_for_user_on_tenant(tenant_id, self.id).body['roles']
|
||||
else
|
||||
[]
|
||||
end
|
||||
end
|
||||
end # class User
|
||||
end # class V2
|
||||
|
|
Loading…
Reference in a new issue