class OpenStack::Keystone::Admin::User
An OpenStack
User
(“admin view”)
Attributes¶ ↑
-
name
- The name of this user -
password
- Password (possibly encrypted) of this user -
email
- E-mail address of this user -
enabled
- True if this user is enabled -
tenant_id
- Default (i.e. primary) tenant for this user
Public Class Methods
List of users in a given tenant
Attributes¶ ↑
-
tenant
- An instance ofOpenStack::Keystone::Admin::Tenant
or a tenant id
# File lib/open_stack/keystone/admin/user.rb, line 88 def self.all_by_tenant(tenant) tenant_id = tenant.is_a?(OpenStack::Keystone::Admin::Tenant) ? tenant.id : tenant all.select { |user| user.tenant_id == tenant_id } end
Find a user in a given tenant
Attributes¶ ↑
-
id
- The user id -
tenant
- An instance ofOpenStack::Keystone::Admin::Tenant
or a tenant id
# File lib/open_stack/keystone/admin/user.rb, line 99 def self.find_by_tenant(id, tenant) tenant_id = tenant.is_a?(OpenStack::Keystone::Admin::Tenant) ? tenant.id : tenant user = self.find(id) user.tenant_id == tenant_id ? user : nil end
Public Instance Methods
File role(s) (i.e. instances of OpenStack::Keystone::Admin::UserRole) for this user in a given tenant
Attributes¶ ↑
-
scope
- TheActiveResource
scope (defaults to :all) -
tenant
- An optional instance ofOpenStack::Keystone::Admin::Tenant
(or a tenant id). Defaults to the primary tenant for this user
# File lib/open_stack/keystone/admin/user.rb, line 132 def roles(scope = :all, tenant = nil) tenant_id = tenant.is_a?(OpenStack::Keystone::Admin::Tenant) ? tenant.id : (tenant || self.tenant_id) UserRole.find(scope, :params => {:tenant_id => tenant_id, :user_id => self.id}) end
The primary (default) tenant (i.e. an instance of OpenStack::Keystone::Admin::Tenant
) associated with this user
# File lib/open_stack/keystone/admin/user.rb, line 115 def tenant OpenStack::Keystone::Admin::Tenant.find tenant_id end
Set the primary (default) tenant associated with this user
Attributes¶ ↑
-
primary_tenant
- A valid tenant or a tenant_id
# File lib/open_stack/keystone/admin/user.rb, line 123 def tenant=(primary_tenant) self.tenant_id = primary_tenant.is_a?(OpenStack::Keystone::Admin::Tenant) ? primary_tenant.id : primary_tenant end
Protected Instance Methods
# File lib/open_stack/keystone/admin/user.rb, line 54 def initialize(attributes = {}, persisted = false) # :notnew: attributes = attributes.with_indifferent_access if attributes[:tenant].present? attributes[:tenant_id] = attributes.delete(:tenant).id end if attributes[:tenantId].present? attributes[:tenant_id] = attributes.delete(:tenantId) end super(attributes, persisted) end