- Notifications
You must be signed in to change notification settings - Fork 4.9k
Source Okta: add permission stream under a custom role #14739
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits Select commit Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions 1 airbyte-integrations/connectors/source-okta/source_okta/schemas/custom_roles.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions 79 airbyte-integrations/connectors/source-okta/source_okta/schemas/permissions.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| { | ||
| "description": "Gets the list of permissions included in a Custom Role identified by its id", | ||
| "properties": { | ||
| "label": { | ||
| "enum": [ | ||
| "okta.users.manage", | ||
| "okta.users.create", | ||
| "okta.users.read", | ||
| "okta.users.credentials.manage", | ||
| "okta.users.credentials.resetFactors", | ||
| "okta.users.credentials.resetPassword", | ||
| "okta.users.credentials.expirePassword", | ||
| "okta.users.userprofile.manage", | ||
| "okta.users.lifecycle.manage", | ||
| "okta.users.lifecycle.activate", | ||
| "okta.users.lifecycle.deactivate", | ||
| "okta.users.lifecycle.suspend", | ||
| "okta.users.lifecycle.unsuspend", | ||
| "okta.users.lifecycle.delete", | ||
| "okta.users.lifecycle.unlock", | ||
| "okta.users.lifecycle.clearSessions", | ||
| "okta.users.groupMembership.manage", | ||
| "okta.users.appAssignment.manage", | ||
| "okta.groups.manage", | ||
| "okta.groups.create", | ||
| "okta.groups.members.manage", | ||
| "okta.groups.read", | ||
| "okta.groups.appAssignment.manage", | ||
| "okta.apps.read", | ||
| "okta.apps.manage", | ||
| "okta.apps.assignment.manage", | ||
| "okta.profilesources.import.run", | ||
| "okta.authzServers.read", | ||
| "okta.authzServers.manage", | ||
| "okta.customizations.read", | ||
| "okta.customizations.manage", | ||
| "okta.workflows.invoke" | ||
| ], | ||
| "type": "string", | ||
| "description": "Type of permissions" | ||
| }, | ||
| "created": { | ||
| "format": "date-time", | ||
| "type": "string" | ||
| }, | ||
| "lastUpdated": { | ||
| "format": "date-time", | ||
| "type": "string" | ||
| }, | ||
| "_links": { | ||
| "properties": { | ||
| "assignee": { | ||
| "properties": { | ||
| "self": { | ||
| "type": ["null", "object"], | ||
| "additionalProperties": true, | ||
| "properties": { | ||
| "href": { | ||
| "type": ["null", "string"] | ||
| } | ||
| } | ||
| }, | ||
| "role": { | ||
| "type": ["null", "object"], | ||
| "additionalProperties": true, | ||
| "properties": { | ||
| "href": { | ||
| "type": ["null", "string"] | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "type": ["object", "null"] | ||
| } | ||
| }, | ||
| "type": "object" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| | @@ -223,6 +223,7 @@ def request_params( | |
| | ||
| | ||
| class CustomRoles(OktaStream): | ||
| # https://developer.okta.com/docs/reference/api/roles/#list-roles | ||
| primary_key = "id" | ||
| | ||
| def path(self, **kwargs) -> str: | ||
| | @@ -250,6 +251,28 @@ def path(self, stream_slice: Mapping[str, Any] = None, **kwargs) -> str: | |
| return f"users/{user_id}/roles" | ||
| | ||
| | ||
| class Permissions(OktaStream): | ||
| ||
| # https://developer.okta.com/docs/reference/api/roles/#list-permissions | ||
| primary_key = "label" | ||
| use_cache = True | ||
| | ||
| def parse_response( | ||
| self, | ||
| response: requests.Response, | ||
| **kwargs, | ||
| ) -> Iterable[Mapping]: | ||
| yield from response.json()["permissions"] | ||
| | ||
| def stream_slices(self, **kwargs): | ||
| custom_roles = CustomRoles(authenticator=self.authenticator, url_base=self.url_base) | ||
| for role in custom_roles.read_records(sync_mode=SyncMode.full_refresh): | ||
| yield {"role_id": role["id"]} | ||
| | ||
| def path(self, stream_slice: Mapping[str, Any] = None, **kwargs) -> str: | ||
| role_id = stream_slice["role_id"] | ||
| return f"iam/roles/{role_id}/permissions" | ||
| | ||
| | ||
| class OktaOauth2Authenticator(Oauth2Authenticator): | ||
| def get_refresh_request_body(self) -> Mapping[str, Any]: | ||
| return { | ||
| | @@ -342,4 +365,5 @@ def streams(self, config: Mapping[str, Any]) -> List[Stream]: | |
| CustomRoles(**initialization_params), | ||
| UserRoleAssignments(**initialization_params), | ||
| GroupRoleAssignments(**initialization_params), | ||
| Permissions(**initialization_params), | ||
| ] | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
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.
same for custom roles add link to okta api docs