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: don't allow deleting the user 'user' #4608

Merged
merged 4 commits into from
Jan 17, 2025
Merged

Conversation

chinook25
Copy link
Contributor

What are the main changes you did

How to test

  • log in as admin
  • Go to the admin settings
  • Confirm that the user 'user' no longer has a delete and edit button (like admin and anonymous)

Checklist

  • updated docs in case of new feature
  • added/updated tests
  • added/updated testplan to include a test for this fix, including ref to bug using # notation

@@ -502,8 +502,9 @@ public List<User> getUsers(int limit, int offset) {
@Override
public void removeUser(String user) {
long start = System.currentTimeMillis();
if (user.equals("admin")) throw new MolgenisException("You cant remove admin");
if (user.equals("anonymous")) throw new MolgenisException("You cant remove anonymous");
if (user.equals("admin")) throw new MolgenisException("You can't remove admin");
Copy link
Contributor

Choose a reason for hiding this comment

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

i would prevere ["sddsd', "sdsdds"].contains ....
and to add a regression test

Copy link
Contributor

@dtroelofsprins dtroelofsprins left a comment

Choose a reason for hiding this comment

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

Functional test:

  • Next to admin and anonymous, user also has not delete or disable buttons anymore
  • Can create a new username
  • Can delete / disable other usernames

@chinook25 chinook25 merged commit 5f7751b into master Jan 17, 2025
1 check was pending
@chinook25 chinook25 deleted the fix/no-deleting-user branch January 17, 2025 08:59
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.

fix(admin): deleting "user" should not be possible
3 participants