Class: RubyAem::User
- Inherits:
-
Object
- Object
- RubyAem::User
- Defined in:
- lib/ruby_aem/user.rb
Overview
User class contains API calls related to managing an AEM user.
Instance Method Summary collapse
-
#add_to_group(group_path, group_name) ⇒ Object
Add user to a group.
-
#change_password(old_password, new_password) ⇒ Object
Change the user's password.
-
#create(password) ⇒ Object
Create a new user.
-
#delete ⇒ Object
Delete the user.
-
#exists ⇒ Object
Check whether the user exists or not.
-
#find_authorizable_id ⇒ Object
Find the user's authorizable ID.
-
#initialize(client, path, name) ⇒ Object
constructor
Initialise a user.
-
#set_permission(permission_path, permission_csv) ⇒ Object
Set the user's permission.
Constructor Details
#initialize(client, path, name) ⇒ Object
Initialise a user.
27 28 29 30 31 32 33 |
# File 'lib/ruby_aem/user.rb', line 27 def initialize(client, path, name) @client = client @info = { path: path, name: name } end |
Instance Method Details
#add_to_group(group_path, group_name) ⇒ Object
Add user to a group.
86 87 88 89 |
# File 'lib/ruby_aem/user.rb', line 86 def add_to_group(group_path, group_name) group = RubyAem::Group.new(@client, group_path, group_name) group.add_member(@info[:name]) end |
#change_password(old_password, new_password) ⇒ Object
Change the user's password.
96 97 98 99 100 |
# File 'lib/ruby_aem/user.rb', line 96 def change_password(old_password, new_password) @info[:old_password] = old_password @info[:new_password] = new_password @client.call(self.class, __callee__.to_s, @info) end |
#create(password) ⇒ Object
Create a new user.
39 40 41 42 43 44 45 |
# File 'lib/ruby_aem/user.rb', line 39 def create(password) @info[:password] = password if !@info[:path].match(/^\//) @info[:path] = "/#{@info[:path]}" end @client.call(self.class, __callee__.to_s, @info) end |
#delete ⇒ Object
Delete the user.
50 51 52 53 54 55 56 57 58 |
# File 'lib/ruby_aem/user.rb', line 50 def delete() result = if result.data @info[:path] = RubyAem::Swagger.path(@info[:path]) @client.call(self.class, __callee__.to_s, @info) else result end end |
#exists ⇒ Object
Check whether the user exists or not. If the user exists, this method returns a success result. Otherwise it returns a failure result.
65 66 67 68 |
# File 'lib/ruby_aem/user.rb', line 65 def exists() @info[:path] = RubyAem::Swagger.path(@info[:path]) @client.call(self.class, __callee__.to_s, @info) end |
#find_authorizable_id ⇒ Object
Find the user's authorizable ID.
105 106 107 |
# File 'lib/ruby_aem/user.rb', line 105 def () @client.call(self.class, __callee__.to_s, @info) end |
#set_permission(permission_path, permission_csv) ⇒ Object
Set the user's permission.
75 76 77 78 79 |
# File 'lib/ruby_aem/user.rb', line 75 def (, ) @info[:permission_path] = @info[:permission_csv] = @client.call(self.class, __callee__.to_s, @info) end |