Module: Simpleokta::Client::Groups
- Included in:
- Simpleokta::Client
- Defined in:
- lib/simpleokta/groups.rb
Instance Method Summary collapse
-
#add_user_to_group(group_id, user_id) ⇒ Object
Add a user to a group.
-
#apps_assigned_to_group(group_id) ⇒ Array<Group Object>
Return all applications members of a group have automatically assigned to them.
-
#assign_group_to_application(app_id, group_id) ⇒ Hash<Application Group Object>
Set an application to be automatically assigned to members of a group.
-
#get_assigned_group_for_application(app_id, group_id) ⇒ Group Assignment
Returns an application group assignment.
-
#group(group_id) ⇒ Hash<Group Object>
Return a specific Group in the okta instance.
-
#group_members(group_id) ⇒ Object
Get all members assigned to a group.
-
#groups ⇒ Array<Group Object>
Return all Groups in the okta instance.
-
#remove_group(group_id) ⇒ Object
Remove a group from your org.
-
#remove_group_from_application(app_id, group_id) ⇒ Group Assignment
Set an application to no longer be automatically assigned to members of a group.
-
#remove_user_from_group(group_id, user_id) ⇒ Object
Remove a user from a group.
-
#update_group(group_id, group_data) ⇒ Hash<Group Object>
Update a group in the okta instance.
Instance Method Details
#add_user_to_group(group_id, user_id) ⇒ Object
Add a user to a group
99 100 101 |
# File 'lib/simpleokta/groups.rb', line 99 def add_user_to_group(group_id, user_id) call_with_token('put', "#{Constants::GROUP_API_BASE_PATH}/#{group_id}/users/#{user_id}") end |
#apps_assigned_to_group(group_id) ⇒ Array<Group Object>
Return all applications members of a group have automatically assigned to them.
29 30 31 32 |
# File 'lib/simpleokta/groups.rb', line 29 def apps_assigned_to_group(group_id) response = call_with_token('get', "#{Constants::GROUP_API_BASE_PATH}/#{group_id}/apps") JSON.parse(response.body) end |
#assign_group_to_application(app_id, group_id) ⇒ Hash<Application Group Object>
Set an application to be automatically assigned to members of a group
40 41 42 43 |
# File 'lib/simpleokta/groups.rb', line 40 def assign_group_to_application(app_id, group_id) response = call_with_token('put', "#{Constants::APP_API_BASE_PATH}/#{app_id}/groups/#{group_id}") JSON.parse(response.body) end |
#get_assigned_group_for_application(app_id, group_id) ⇒ Group Assignment
Returns an application group assignment
60 61 62 63 |
# File 'lib/simpleokta/groups.rb', line 60 def get_assigned_group_for_application(app_id, group_id) response = call_with_token('get', "#{Constants::APP_API_BASE_PATH}/#{app_id}/groups/#{group_id}") JSON.parse(response.body) end |
#group(group_id) ⇒ Hash<Group Object>
Return a specific Group in the okta instance.
12 13 14 15 |
# File 'lib/simpleokta/groups.rb', line 12 def group(group_id) response = call_with_token('get', "#{Constants::GROUP_API_BASE_PATH}/#{group_id}") JSON.parse(response.body) end |
#group_members(group_id) ⇒ Object
Get all members assigned to a group
89 90 91 92 |
# File 'lib/simpleokta/groups.rb', line 89 def group_members(group_id) response = call_with_token('get', "#{Constants::GROUP_API_BASE_PATH}/#{group_id}/users") JSON.parse(response.body) end |
#groups ⇒ Array<Group Object>
Return all Groups in the okta instance.
20 21 22 23 |
# File 'lib/simpleokta/groups.rb', line 20 def groups response = call_with_token('get', Constants::GROUP_API_BASE_PATH) JSON.parse(response.body) end |
#remove_group(group_id) ⇒ Object
Remove a group from your org.
81 82 83 |
# File 'lib/simpleokta/groups.rb', line 81 def remove_group(group_id) call_with_token('delete', "#{Constants::GROUP_API_BASE_PATH}/#{group_id}") end |
#remove_group_from_application(app_id, group_id) ⇒ Group Assignment
Set an application to no longer be automatically assigned to members of a group
51 52 53 |
# File 'lib/simpleokta/groups.rb', line 51 def remove_group_from_application(app_id, group_id) call_with_token('delete', "#{Constants::APP_API_BASE_PATH}/#{app_id}/groups/#{group_id}") end |
#remove_user_from_group(group_id, user_id) ⇒ Object
Remove a user from a group
108 109 110 |
# File 'lib/simpleokta/groups.rb', line 108 def remove_user_from_group(group_id, user_id) call_with_token('delete', "#{Constants::GROUP_API_BASE_PATH}/#{group_id}/users/#{user_id}") end |
#update_group(group_id, group_data) ⇒ Hash<Group Object>
Update a group in the okta instance.
71 72 73 74 |
# File 'lib/simpleokta/groups.rb', line 71 def update_group(group_id, group_data) response = call_with_token('put', "#{Constants::GROUP_API_BASE_PATH}/#{group_id}", group_data) JSON.parse(response.body) end |