Sha256: 24cf9699009b021ca2762fd7011fb6c87454081e6c7c7170dde44424b73882ea

Contents?: true

Size: 1.23 KB

Versions: 104

Compression:

Stored size: 1.23 KB

Contents

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

Version data entries

104 entries across 102 versions & 11 rubygems

Version Path
fog-1.21.0 lib/fog/rackspace/models/identity/user.rb
fog-maestrodev-1.20.0.20140305101839 lib/fog/rackspace/models/identity/user.rb
fog-maestrodev-1.20.0.20140305101305 lib/fog/rackspace/models/identity/user.rb
fog-maestrodev-1.19.0.20140212012611 lib/fog/rackspace/models/identity/user.rb
fog-1.20.0 lib/fog/rackspace/models/identity/user.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/rackspace/models/identity/user.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/rackspace/models/identity/user.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/rackspace/models/identity/user.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/rackspace/models/identity/user.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/rackspace/models/identity/user.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/rackspace/models/identity/user.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/rackspace/models/identity/user.rb
fog-1.19.0 lib/fog/rackspace/models/identity/user.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/rackspace/models/identity/user.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/rackspace/models/identity/user.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/rackspace/models/identity/user.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/rackspace/models/identity/user.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/rackspace/models/identity/user.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/rackspace/models/identity/user.rb
fog-maestrodev-1.18.0.20131209090811 lib/fog/rackspace/models/identity/user.rb