Skip to content
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

Permissions #73

Merged
merged 14 commits into from
Oct 13, 2023
Merged

Permissions #73

merged 14 commits into from
Oct 13, 2023

Conversation

mike-pisman
Copy link
Member

@mike-pisman mike-pisman commented Oct 13, 2023

Permissions overhaul. This PR adds new function check_permissions to the Permission module. This functions can be used to check if the current user has required permissions in the provided resource. The old permission check based on operation_id was removed along with related dependencies. The Actions were updated to utilize the new function to check permissions.

Updated permission names, added utility function check_permissions which checks if user has required permissions based on provided resource and permission requirements, renamed check_permission to compare_permissions
Removed permission check dependencies, added http wrapper for resource accessors
Added permission check to actions using new check_permission function
check_permissions raises UserNotAuthorized from ResourceExceptions, so even though the permission is checked inside workspace, it will not raise WorkspaceExceptions
Changed required permissions from add_members to get_members
check_permissions does not return anything but raises an exception in case user does not have the required permission, so the check must be made using try-catch block
Changed old permission set_policy to the new update_policies
Added case when user does not provide account_id in update_policy request, with the else statement, the route will find current user's policy
The new policy action will return the users policy even if the user does not have permission to get_policies
@mike-pisman mike-pisman merged commit 5e0ed7d into main Oct 13, 2023
@mike-pisman mike-pisman deleted the permissions branch October 13, 2023 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant