module Simpleokta::Client::Groups
Public Instance Methods
Add a user to a group @param group_id [String] the unique identifier of the group @param user_id [String] the unique identifier of the user @return 204 No Content @see developer.okta.com/docs/reference/api/groups/#add-user-to-group
# 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
Return all applications members of a group have automatically assigned to them. @param group_id [String] the unique identifier of the group @return [Array<Group Object>] @see developer.okta.com/docs/reference/api/apps/#application-object Application Object
# 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
Set an application to be automatically assigned to members of a group @param app_id [String] the unique id of the application @param group_id [String] the unique identifier of the group @return [Hash<Application Group Object>] @see developer.okta.com/docs/reference/api/apps/#assign-group-to-application Assign Group to Application @see developer.okta.com/docs/reference/api/apps/#application-key-credential-object Application Group Object
# 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
Returns an application group assignment @param app_id [String] the unique id of the application @param group_id [String] the unique identifier of the group @return [Group Assignment] @see developer.okta.com/docs/reference/api/apps/#response-example-34 Group Assignment Response
# 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
Return a specific Group in the okta instance. @return [Hash<Group Object>] @param group_id [String] the unique identifier of the group @see developer.okta.com/docs/reference/api/groups/#group-object Group Object
# 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
Get all members assigned to a group @param group_id [String] the unique identifier of the group @return 204 No Content @see developer.okta.com/docs/reference/api/groups/#list-group-members List Group Members
# 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
Return all Groups
in the okta instance. @return [Array<Group Object>] @see developer.okta.com/docs/reference/api/groups/#group-object Group Object
# 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 a group from your org. @param group_id [String] the unique identifier of the group @return 204 No Content @see developer.okta.com/docs/reference/api/apps/#application-object Application Object @see developer.okta.com/docs/reference/api/groups/#remove-group Remove Group
# File lib/simpleokta/groups.rb, line 81 def remove_group(group_id) call_with_token('delete', "#{Constants::GROUP_API_BASE_PATH}/#{group_id}") end
Set an application to no longer be automatically assigned to members of a group @param app_id [String] the unique id of the application @param group_id [String] the unique identifier of the group @return [Group Assignment] @see developer.okta.com/docs/reference/api/apps/#response-example-34 Group Assignment Response @see developer.okta.com/docs/reference/api/apps/#assign-group-to-application Assign Group To Application
# 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 a user from a group @param group_id [String] the unique identifier of the group @param user_id [String] the unique identifier of the user @return 204 No Content @see developer.okta.com/docs/reference/api/groups/#remove-user-from-group Add User To Group
# 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 a group in the okta instance. @param group_id [String] the unique identifier of the group @param group_data [Hash] the data you want the group to contain @return [Hash<Group Object>] @see developer.okta.com/docs/reference/api/apps/#application-object Application Object @see developer.okta.com/docs/reference/api/groups/#update-group Update Group
# 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