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

feat: Additional Household Permissions #4158

Conversation

michael-genson
Copy link
Collaborator

What type of PR is this?

(REQUIRED)

  • bug
  • cleanup
  • feature

What this PR does / why we need it:

(REQUIRED)

This PR adds two household-related permissions:

  • Household Preference: Lock Recipe Edits From Other Households
  • User Permission: Can Manage Household

Lock Recipe Edits From Other Households

This flag lets households decide if other households can only view their recipes, or if they can edit them. With this unflagged, any user from any household in the group can edit their recipes.

When set, it behaves like it was implemented in #4089 (users from other households can't edit). When unset, edits (including deletes) are allowed (this is a new feature from this PR).

Can Manage Household

This flag allows users to manage household settings (such as the new lock recipe edits flag). Previously this was tied to the generic Can Manage permission, but it makes sense to want users to be able to manage their own households, but not necessarily manage the group.


Both flags are added to their respective settings pages:
image
image
image
image

I also merged the two household settings pages; one was using a component, and one was just baked into the page, so I replaced the page one with the component. The component was missing all of the help text, so I re-wrote it to support the help text.

For reference, it currently looks like this:
image

And now it looks like this:
image

Which issue(s) this PR fixes:

(REQUIRED)

Closes #4082

Special notes for your reviewer:

(fill-in or delete this section)

I added a new route to fetch a household by id, since we need to check permissions of the recipe's household (which isn't always your household anymore). I also fixed the inconsistency where getting a recipe by id works, but updating/deleting only works by slug. All recipe routes should accept either slugs or ids now.

Testing

(fill-in or delete this section)

frontend and backend tests

Copy link
Collaborator

@Kuchenpirat Kuchenpirat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was alot, but luckily most of it was pretty self-explanatory. Just a few mini-comments. Did not find anything major. Will do a bit more real-world testing now but i think we are looking good 👍

Copy link
Collaborator

@Kuchenpirat Kuchenpirat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 🚀

@michael-genson michael-genson merged commit fd0257c into mealie-recipes:mealie-next Sep 17, 2024
13 checks passed
@michael-genson michael-genson deleted the feat/additional-household-permissions branch September 17, 2024 15:48
boc-the-git pushed a commit to boc-the-git/mealie that referenced this pull request Sep 28, 2024
Co-authored-by: Kuchenpirat <24235032+Kuchenpirat@users.noreply.github.com>
boc-the-git pushed a commit to boc-the-git/mealie that referenced this pull request Sep 28, 2024
Co-authored-by: Kuchenpirat <24235032+Kuchenpirat@users.noreply.github.com>
Choromanski pushed a commit to Choromanski/mealie that referenced this pull request Oct 1, 2024
Co-authored-by: Kuchenpirat <24235032+Kuchenpirat@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task] - Household Permissions
2 participants