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

Forbid deleting the last staff user #1036

Merged
merged 8 commits into from Aug 29, 2023
Merged

Conversation

felixrindt
Copy link
Member

@felixrindt felixrindt commented Aug 24, 2023

depends on #1037 so rebase main onto that first

  • protect actions that lead to no active user having management permissions (removing users from groups etc)
  • add more tests

@felixrindt felixrindt added the [C] bug Something isn't working label Aug 24, 2023
@felixrindt felixrindt requested a review from jeriox August 24, 2023 14:19
@coveralls
Copy link

coveralls commented Aug 24, 2023

Coverage Status

Changes unknown when pulling 138998c on fix-cannot-delete-last-staff-user into ** on main**.

Copy link
Contributor

@jeriox jeriox left a comment

Choose a reason for hiding this comment

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

do we want to implement similar checks for at least one group with the "can manage ephios instance" permission? AFAIS you could loose that permission and even staff users wouldn't be able to recover it

@felixrindt
Copy link
Member Author

do we want to implement similar checks for at least one group with the "can manage ephios instance" permission? AFAIS you could loose that permission and even staff users wouldn't be able to recover it

I think that's a very good idea. UX wise we could also just disable the delete button instead of showing the error only after people hit delete. What do you think?

@jeriox
Copy link
Contributor

jeriox commented Aug 25, 2023

do we want to implement similar checks for at least one group with the "can manage ephios instance" permission? AFAIS you could loose that permission and even staff users wouldn't be able to recover it

I think that's a very good idea. UX wise we could also just disable the delete button instead of showing the error only after people hit delete. What do you think?

yes that would be a bit smoother, but I could also live with the version you implemented here

@felixrindt felixrindt force-pushed the fix-cannot-delete-last-staff-user branch from 636d5fd to 8817563 Compare August 27, 2023 00:02
@felixrindt felixrindt requested a review from jeriox August 28, 2023 06:56
@felixrindt felixrindt force-pushed the fix-cannot-delete-last-staff-user branch 3 times, most recently from 9fdc1b8 to d630f93 Compare August 28, 2023 08:07
@felixrindt felixrindt force-pushed the fix-cannot-delete-last-staff-user branch from d630f93 to 138998c Compare August 28, 2023 12:50
ephios/core/forms/users.py Show resolved Hide resolved
@felixrindt felixrindt enabled auto-merge (rebase) August 29, 2023 08:34
@felixrindt felixrindt merged commit 594530b into main Aug 29, 2023
17 checks passed
@felixrindt felixrindt deleted the fix-cannot-delete-last-staff-user branch August 29, 2023 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C] bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants