-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SDK-4546] Add orgs in client credentials support #540
Changes from all commits
43bb301
1313223
6f31af5
29e81f4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -330,6 +330,52 @@ def delete_organizations_member_roles(organization_id, user_id, roles = []) | |
end | ||
alias remove_organizations_member_roles delete_organizations_member_roles | ||
|
||
# Get client grants associated to an organization | ||
# @param organization_id [string] The Organization ID | ||
# @param options [hash] The Hash options used to define the paging of results | ||
# * :client_id [string] The client_id of the client grant to retrieve. | ||
# * :audience [string] The audience of the client grant to retrieve. | ||
# * :per_page [integer] The amount of entries per page. Default: 50. Max value: 100. | ||
# * :page [integer] The page number. Zero based. | ||
# * :include_totals [boolean] True to include query summary in the result, false or nil otherwise. | ||
def get_organizations_client_grants(organization_id, options= {}) | ||
raise Auth0::MissingOrganizationId, 'Must supply a valid organization_id' if organization_id.to_s.empty? | ||
request_params = { | ||
client_id: options.fetch(:client_id, nil), | ||
audience: options.fetch(:audience, nil), | ||
per_page: options.fetch(:per_page, nil), | ||
page: options.fetch(:page, nil), | ||
include_totals: options.fetch(:include_totals, nil) | ||
} | ||
path = "#{organizations_client_grants_path(organization_id)}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it necessary to interpolate the return value, if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe not? Am just being consistent with the rest of the file https://github.com/auth0/ruby-auth0/pull/540/files/43bb301afee4d5ebd923eb897b53b998bc3465b6#diff-3936cbc470adbe60f39a627f01d4259b0c1121de790b4e7d3144c536f073ccf7R324 |
||
get(path, request_params) | ||
end | ||
|
||
# Associate a client grant with an organization | ||
# @param organization_id [string] The Organization ID | ||
# @param grant_id [string] The Client Grant ID you want to associate to the Organization. | ||
def create_organizations_client_grant(organization_id, grant_id) | ||
raise Auth0::MissingOrganizationId, 'Must supply a valid organization_id' if organization_id.to_s.empty? | ||
raise Auth0::InvalidParameter, 'Must supply a valid grant_id' if grant_id.to_s.empty? | ||
|
||
body = {} | ||
body[:grant_id] = grant_id | ||
|
||
path = "#{organizations_client_grants_path(organization_id)}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as before, is the string interpolation necessary? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as before, just being consistent... |
||
post(path, body) | ||
end | ||
|
||
# Remove a client grant from an organization | ||
# @param organization_id [string] The Organization ID | ||
# @param grant_id [string] The Client Grant ID you want to remove from the Organization. | ||
def delete_organizations_client_grant(organization_id, grant_id) | ||
raise Auth0::MissingOrganizationId, 'Must supply a valid organization_id' if organization_id.to_s.empty? | ||
raise Auth0::InvalidParameter, 'Must supply a valid grant_id' if grant_id.to_s.empty? | ||
|
||
path = "#{organizations_path}/#{organization_id}/client-grants/#{grant_id}" | ||
delete(path) | ||
end | ||
|
||
private | ||
# Organizations API path | ||
def organizations_path | ||
|
@@ -351,6 +397,10 @@ def organizations_member_roles_path(org_id, user_id) | |
def organizations_invitations_path(org_id) | ||
"#{organizations_path}/#{org_id}/invitations" | ||
end | ||
|
||
def organizations_client_grants_path(org_id) | ||
"#{organizations_path}/#{org_id}/client-grants" | ||
end | ||
end | ||
end | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we expand a bit on what
allow_any_organization
does?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd agree if you were getting/setting the
allow_any_organization
field, but this is a filter on the value