Class: Artifactory::Resource::User
- Defined in:
- lib/artifactory/resources/user.rb
Class Method Summary collapse
-
.all(options = {}) ⇒ Array<Resource::User>
Get a list of all users in the system.
-
.find(name, options = {}) ⇒ Resource::User?
Find (fetch) a user by its name.
Instance Method Summary collapse
-
#admin ⇒ Object
Return this object’s
admin
. -
#admin=(value) ⇒ Object
Set this object’s
admin
. -
#admin? ⇒ Boolean
Determines if the
admin
value exists and is truthy. -
#delete ⇒ Boolean
Delete this user from artifactory, suppressing any
ResourceNotFound
exceptions might occur. -
#email ⇒ Object
Return this object’s
email
. -
#email=(value) ⇒ Object
Set this object’s
email
. -
#email? ⇒ Boolean
Determines if the
email
value exists and is truthy. -
#groups ⇒ Object
Return this object’s
groups
. -
#groups=(value) ⇒ Object
Set this object’s
groups
. -
#groups? ⇒ Boolean
Determines if the
groups
value exists and is truthy. -
#internal_password_disabled ⇒ Object
Return this object’s
internal_password_disabled
. -
#internal_password_disabled=(value) ⇒ Object
Set this object’s
internal_password_disabled
. -
#internal_password_disabled? ⇒ Boolean
Determines if the
internal_password_disabled
value exists and is truthy. -
#last_logged_in ⇒ Object
Return this object’s
last_logged_in
. -
#last_logged_in=(value) ⇒ Object
Set this object’s
last_logged_in
. -
#last_logged_in? ⇒ Boolean
Determines if the
last_logged_in
value exists and is truthy. -
#name ⇒ Object
Return this object’s
name
. -
#name=(value) ⇒ Object
Set this object’s
name
. -
#name? ⇒ Boolean
Determines if the
name
value exists and is truthy. -
#password ⇒ Object
Return this object’s
password
. -
#password=(value) ⇒ Object
Set this object’s
password
. -
#password? ⇒ Boolean
Determines if the
password
value exists and is truthy. -
#profile_updatable ⇒ Object
Return this object’s
profile_updatable
. -
#profile_updatable=(value) ⇒ Object
Set this object’s
profile_updatable
. -
#profile_updatable? ⇒ Boolean
Determines if the
profile_updatable
value exists and is truthy. -
#realm ⇒ Object
Return this object’s
realm
. -
#realm=(value) ⇒ Object
Set this object’s
realm
. -
#realm? ⇒ Boolean
Determines if the
realm
value exists and is truthy. -
#save ⇒ Boolean
Creates or updates a user configuration depending on if the user configuration previously existed.
Methods inherited from Base
attribute, attributes, #attributes, #client, #client=, #client?, #extract_client!, extract_client!, find_from_config, #format_repos!, format_repos!, from_hash, from_url, has_attribute?, #initialize, #inspect, list_from_config, #set, #to_hash, #to_json, #to_matrix_properties, #to_query_string_parameters, #to_s, #url_safe, url_safe
Constructor Details
This class inherits a constructor from Artifactory::Resource::Base
Class Method Details
.all(options = {}) ⇒ Array<Resource::User>
Get a list of all users in the system.
32 33 34 35 36 37 |
# File 'lib/artifactory/resources/user.rb', line 32 def all( = {}) client = extract_client!() client.get('/api/security/users').map do |hash| from_url(hash['uri'], client: client) end end |
.find(name, options = {}) ⇒ Resource::User?
Find (fetch) a user by its name.
57 58 59 60 61 62 63 64 65 |
# File 'lib/artifactory/resources/user.rb', line 57 def find(name, = {}) client = extract_client!() response = client.get("/api/security/users/#{url_safe(name)}") from_hash(response, client: client) rescue Error::HTTPError => e raise unless e.code == 404 nil end |
Instance Method Details
#admin ⇒ Object
Return this object’s admin
68 |
# File 'lib/artifactory/resources/user.rb', line 68 attribute :admin, false |
#admin=(value) ⇒ Object
Set this object’s admin
68 |
# File 'lib/artifactory/resources/user.rb', line 68 attribute :admin, false |
#admin? ⇒ Boolean
Determines if the admin
value exists and is truthy
68 |
# File 'lib/artifactory/resources/user.rb', line 68 attribute :admin, false |
#delete ⇒ Boolean
Delete this user from artifactory, suppressing any ResourceNotFound
exceptions might occur.
85 86 87 88 89 90 |
# File 'lib/artifactory/resources/user.rb', line 85 def delete client.delete(api_path) true rescue Error::HTTPError => e false end |
#email ⇒ Object
Return this object’s email
69 |
# File 'lib/artifactory/resources/user.rb', line 69 attribute :email |
#email=(value) ⇒ Object
Set this object’s email
69 |
# File 'lib/artifactory/resources/user.rb', line 69 attribute :email |
#email? ⇒ Boolean
Determines if the email
value exists and is truthy
69 |
# File 'lib/artifactory/resources/user.rb', line 69 attribute :email |
#groups ⇒ Object
Return this object’s groups
70 |
# File 'lib/artifactory/resources/user.rb', line 70 attribute :groups, [] |
#groups=(value) ⇒ Object
Set this object’s groups
70 |
# File 'lib/artifactory/resources/user.rb', line 70 attribute :groups, [] |
#groups? ⇒ Boolean
Determines if the groups
value exists and is truthy
70 |
# File 'lib/artifactory/resources/user.rb', line 70 attribute :groups, [] |
#internal_password_disabled ⇒ Object
Return this object’s internal_password_disabled
71 |
# File 'lib/artifactory/resources/user.rb', line 71 attribute :internal_password_disabled, false |
#internal_password_disabled=(value) ⇒ Object
Set this object’s internal_password_disabled
71 |
# File 'lib/artifactory/resources/user.rb', line 71 attribute :internal_password_disabled, false |
#internal_password_disabled? ⇒ Boolean
Determines if the internal_password_disabled
value exists and is truthy
71 |
# File 'lib/artifactory/resources/user.rb', line 71 attribute :internal_password_disabled, false |
#last_logged_in ⇒ Object
Return this object’s last_logged_in
72 |
# File 'lib/artifactory/resources/user.rb', line 72 attribute :last_logged_in |
#last_logged_in=(value) ⇒ Object
Set this object’s last_logged_in
72 |
# File 'lib/artifactory/resources/user.rb', line 72 attribute :last_logged_in |
#last_logged_in? ⇒ Boolean
Determines if the last_logged_in
value exists and is truthy
72 |
# File 'lib/artifactory/resources/user.rb', line 72 attribute :last_logged_in |
#name ⇒ Object
Return this object’s name
73 |
# File 'lib/artifactory/resources/user.rb', line 73 attribute :name, -> { raise 'Name missing' } |
#name=(value) ⇒ Object
Set this object’s name
73 |
# File 'lib/artifactory/resources/user.rb', line 73 attribute :name, -> { raise 'Name missing' } |
#name? ⇒ Boolean
Determines if the name
value exists and is truthy
73 |
# File 'lib/artifactory/resources/user.rb', line 73 attribute :name, -> { raise 'Name missing' } |
#password ⇒ Object
Return this object’s password
74 |
# File 'lib/artifactory/resources/user.rb', line 74 attribute :password |
#password=(value) ⇒ Object
Set this object’s password
74 |
# File 'lib/artifactory/resources/user.rb', line 74 attribute :password |
#password? ⇒ Boolean
Determines if the password
value exists and is truthy
74 |
# File 'lib/artifactory/resources/user.rb', line 74 attribute :password |
#profile_updatable ⇒ Object
Return this object’s profile_updatable
75 |
# File 'lib/artifactory/resources/user.rb', line 75 attribute :profile_updatable, true |
#profile_updatable=(value) ⇒ Object
Set this object’s profile_updatable
75 |
# File 'lib/artifactory/resources/user.rb', line 75 attribute :profile_updatable, true |
#profile_updatable? ⇒ Boolean
Determines if the profile_updatable
value exists and is truthy
75 |
# File 'lib/artifactory/resources/user.rb', line 75 attribute :profile_updatable, true |
#realm ⇒ Object
Return this object’s realm
76 |
# File 'lib/artifactory/resources/user.rb', line 76 attribute :realm |
#realm=(value) ⇒ Object
Set this object’s realm
76 |
# File 'lib/artifactory/resources/user.rb', line 76 attribute :realm |
#realm? ⇒ Boolean
Determines if the realm
value exists and is truthy
76 |
# File 'lib/artifactory/resources/user.rb', line 76 attribute :realm |
#save ⇒ Boolean
Creates or updates a user configuration depending on if the user configuration previously existed.
98 99 100 101 102 103 104 105 |
# File 'lib/artifactory/resources/user.rb', line 98 def save if self.class.find(name, client: client) client.post(api_path, to_json, headers) else client.put(api_path, to_json, headers) end true end |