Module: Conjur::ActsAsUser

Includes:
ActsAsRole
Included in:
Deputy, User
Defined in:
lib/conjur/acts_as_user.rb

Overview

This module provides methods for things that are like users (specifically, those that have api keys).

Instance Method Summary collapse

Methods included from ActsAsRole

#can, #cannot, #role, #role_kind, #roleid

Instance Method Details

#apiConjur::API

Note:

As with #api_key, this method only works on newly created instances.

Create an api logged in as this user-like thing.

Returns:

  • (Conjur::API)

    an api logged in as this user-like thing.

See Also:



43
44
45
# File 'lib/conjur/acts_as_user.rb', line 43

def api
  Conjur::API.new_from_key , api_key
end

#api_keyString

Note:

this method can only be called on newly created user-like things (those returned from, for example,) Conjur::API#create_user.

Returns a newly created user's api_key.

Returns:

  • (String)

    the api key

Raises:

  • (Exception)

    when the object isn't newly created.



34
35
36
# File 'lib/conjur/acts_as_user.rb', line 34

def api_key
  attributes['api_key'] or raise "api_key is only available on a newly created #{self.class.name.downcase}"
end