Module: Simpleokta::Client::Users
- Included in:
- Simpleokta::Client
- Defined in:
- lib/simpleokta/users.rb
Instance Method Summary collapse
-
#activate_user(user_id, send_email) ⇒ Hash
Activate a user in the okta instance.
-
#apps_assigned_to_user(user_id) ⇒ Array<Application Object>
List all applications a user currently has assigned to them.
-
#create_and_activate_user(user_profile_data) ⇒ Hash<User>
Create an activated user in the okta instance without credentials.
-
#create_user(user_profile_data) ⇒ Hash<User>
Create a user in the okta instance without credentials.
-
#create_user_in_group(user_profile_data, group_id_array) ⇒ Hash<User>
Create a user in the okta insance, and have the user added to groups.
-
#deactivate_user(user_id, send_email) ⇒ Hash
Deactivates a user in the okta instance.
-
#delete_user(user_id) ⇒ Hash<User>
Delete a user in the okta instance.
-
#reactivate_user(user_id, send_email) ⇒ Hash
Reactivates a user in the okta instance that was deactivated.
-
#suspend_user(user_id) ⇒ Hash
Suspend a user in the okta instance.
-
#unlock_user(user_id) ⇒ Hash
Unlocks a user in the okta instance.
-
#unsuspend_user(user_id) ⇒ Hash
Unsuspend a user in the okta instance.
-
#update_user(user_id, user_profile_data) ⇒ Hash<User>
Update a user in the okta instance.
-
#user(user_id) ⇒ Hash<User>
Return a specific user in an okta instance.
-
#user_from_login(login) ⇒ Hash<User>
Return a specific user in an okta instance.
-
#users ⇒ Array<User>
Return all users in an okta instance.
Instance Method Details
#activate_user(user_id, send_email) ⇒ Hash
Activate a user in the okta instance.
Users created are not immediately activated until they log on. This method bypasses that requirement
106 107 108 109 110 |
# File 'lib/simpleokta/users.rb', line 106 def activate_user(user_id, send_email) response = call_with_token('post', "#{Constants::USER_API_BASE_PATH}/#{user_id}/lifecycle/activate?sendEmail=#{send_email}") JSON.parse(response.body) end |
#apps_assigned_to_user(user_id) ⇒ Array<Application Object>
List all applications a user currently has assigned to them.
167 168 169 170 |
# File 'lib/simpleokta/users.rb', line 167 def apps_assigned_to_user(user_id) response = call_with_token('get', "#{Constants::APP_API_BASE_PATH}/?filter=user.id+eq+\"#{user_id}\"") JSON.parse(response.body) end |
#create_and_activate_user(user_profile_data) ⇒ Hash<User>
Create an activated user in the okta instance without credentials
59 60 61 62 |
# File 'lib/simpleokta/users.rb', line 59 def create_and_activate_user(user_profile_data) response = call_with_token('post', "#{Constants::USER_API_BASE_PATH}?activate=true", user_profile_data) JSON.parse(response.body) end |
#create_user(user_profile_data) ⇒ Hash<User>
Create a user in the okta instance without credentials
48 49 50 51 |
# File 'lib/simpleokta/users.rb', line 48 def create_user(user_profile_data) response = call_with_token('post', "#{Constants::USER_API_BASE_PATH}?activate=false", user_profile_data) JSON.parse(response.body) end |
#create_user_in_group(user_profile_data, group_id_array) ⇒ Hash<User>
Create a user in the okta insance, and have the user added to groups
71 72 73 74 75 76 |
# File 'lib/simpleokta/users.rb', line 71 def create_user_in_group(user_profile_data, group_id_array) body = user_profile_data body[:groupIds] = group_id_array response = call_with_token('post', Constants::USER_API_BASE_PATH, body) JSON.parse(response.body) end |
#deactivate_user(user_id, send_email) ⇒ Hash
Deactivates a user in the okta instance.
129 130 131 132 133 |
# File 'lib/simpleokta/users.rb', line 129 def deactivate_user(user_id, send_email) response = call_with_token('post', "#{Constants::USER_API_BASE_PATH}/#{user_id}/lifecycle/deactivate?sendEmail=#{send_email}") JSON.parse(response.body) end |
#delete_user(user_id) ⇒ Hash<User>
Delete a user in the okta instance
82 83 84 85 |
# File 'lib/simpleokta/users.rb', line 82 def delete_user(user_id) response = call_with_token('delete', "#{Constants::USER_API_BASE_PATH}/#{user_id}") response end |
#reactivate_user(user_id, send_email) ⇒ Hash
Reactivates a user in the okta instance that was deactivated.
118 119 120 121 122 |
# File 'lib/simpleokta/users.rb', line 118 def reactivate_user(user_id, send_email) response = call_with_token('post', "#{Constants::USER_API_BASE_PATH}/#{user_id}/lifecycle/reactivate?sendEmail=#{send_email}") JSON.parse(response.body) end |
#suspend_user(user_id) ⇒ Hash
Suspend a user in the okta instance.
139 140 141 |
# File 'lib/simpleokta/users.rb', line 139 def suspend_user(user_id) call_with_token('post', "#{Constants::USER_API_BASE_PATH}/#{user_id}/lifecycle/suspend") end |
#unlock_user(user_id) ⇒ Hash
Unlocks a user in the okta instance.
Only available when a user has LOCKED_OUT status.
Sets the user status to ACTIVE.
158 159 160 |
# File 'lib/simpleokta/users.rb', line 158 def unlock_user(user_id) call_with_token('post', "#{Constants::USER_API_BASE_PATH}/#{user_id}/lifecycle/unlock") end |
#unsuspend_user(user_id) ⇒ Hash
Unsuspend a user in the okta instance.
Sets the user status to ACTIVE.
148 149 150 |
# File 'lib/simpleokta/users.rb', line 148 def unsuspend_user(user_id) call_with_token('post', "#{Constants::USER_API_BASE_PATH}/#{user_id}/lifecycle/unsuspend") end |
#update_user(user_id, user_profile_data) ⇒ Hash<User>
Update a user in the okta instance
94 95 96 97 |
# File 'lib/simpleokta/users.rb', line 94 def update_user(user_id, user_profile_data) response = call_with_token('put', "#{Constants::USER_API_BASE_PATH}/#{user_id}", user_profile_data) JSON.parse(response.body) end |
#user(user_id) ⇒ Hash<User>
Return a specific user in an okta instance
20 21 22 23 |
# File 'lib/simpleokta/users.rb', line 20 def user(user_id) response = call_with_token('get', "#{Constants::USER_API_BASE_PATH}/#{user_id}") JSON.parse(response.body) end |
#user_from_login(login) ⇒ Hash<User>
Return a specific user in an okta instance
29 30 31 32 |
# File 'lib/simpleokta/users.rb', line 29 def user_from_login(login) response = call_with_token('get', "#{Constants::USER_API_BASE_PATH}/#{ERB::Util.url_encode(login)}") JSON.parse(response.body) end |
#users ⇒ Array<User>
Return all users in an okta instance
11 12 13 14 |
# File 'lib/simpleokta/users.rb', line 11 def users response = call_with_token('get', Constants::USER_API_BASE_PATH) JSON.parse(response.body) end |