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

fix: Limit shopping list owners to current group #3305

Conversation

michael-genson
Copy link
Collaborator

What type of PR is this?

(REQUIRED)

  • bug

What this PR does / why we need it:

(REQUIRED)

The shopping list owner added in #3213 adds a setting on the shopping list to update the owner. This API call actually uses the admin route erroneously, so only admins can update the owner. Furthermore, it shows users from all groups, not just the current group.

This PR adds a new route to fetch only the users belonging to the current user's group, and loosens permissions so that any user can use this API (rather than only admins).

Which issue(s) this PR fixes:

(REQUIRED)

N/A

Special notes for your reviewer:

(fill-in or delete this section)

We should probably update the frontend's user API to prevent this from happening; the user API shouldn't be able to accidentally access the admin API routes, but due to how we've structured the user controller on the backend (the non-admin routes use the same base URL) it's a bit messy when using our generic frontend client. Ideally these are two separate base URLs (e.g. /users and /admin/users but since this would introduce breaking changes it's probably best to just work around it.

Testing

(fill-in or delete this section)

Added backend tests and verified proper behavior on the frontend using a non-admin user.

@hay-kot hay-kot enabled auto-merge (squash) March 13, 2024 18:06
@hay-kot hay-kot merged commit 63a362a into mealie-recipes:mealie-next Mar 13, 2024
10 checks passed
@michael-genson michael-genson deleted the fix/shopping-list-owner-shows-all-users branch March 13, 2024 18:57
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.

None yet

2 participants