-
Notifications
You must be signed in to change notification settings - Fork 35
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
Refactor ApiUsersController #2622
Merged
Merged
Conversation
This file contains 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
chrisroos
force-pushed
the
refactor-api-users-controller
branch
2 times, most recently
from
January 4, 2024 14:00
ecaafe2
to
3ca9b72
Compare
Now that it is only used in this template.
These are a hangover from when this logic was in a partial that was shared between users and api_users templates.
These are a hangover from when this logic was in a partial that was used for both persisted and un-persisted objects.
This currently duplicates the `applications_and_permissions` method but I'll remove that duplication separately.
The `applications_and_permissions` method is now only used for web users, and the `visible_applications` and `api_user_applications_and_permissions` methods are only used for api users.
Now that it's only used by this controller.
Now that it's only used by this controller.
We use the ApiUserPolicy to prevent non-superadmin users from accessing any of the actions in this controller. The visible_applications method is only used in this controller: in `index` via `ApiUsersHelper#application_list` and in `manage_permissions` via `api_user_applications_and_permissions`, so we can rely on our Pundit policy to ensure the current user is a superadmin.
The `visible_applications` method already `includes(:supported_permissions)` so we don't have to repeat that here.
This isn't being used anywhere.
chrisroos
force-pushed
the
refactor-api-users-controller
branch
from
January 4, 2024 16:18
3ca9b72
to
9d4b8aa
Compare
chrisroos
changed the title
WIP: Refactor ApiUsersController
Refactor ApiUsersController
Jan 4, 2024
floehopper
approved these changes
Jan 4, 2024
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.
This all looks great to me - good work! 🎉
Thanks @floehopper! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
These changes should make it a bit easier to move the
ApiUsersController#manage_permissions
functionality to the design system by making the existing behaviour easier to reason about.