flexmeasures icon indicating copy to clipboard operation
flexmeasures copied to clipboard

Display deactivate btn only as admin/account-admin

Open joshuaunity opened this issue 1 year ago • 3 comments

Description

Added condition to display the deactivate button on user detail page only if current logged in user is admin or account-admin

Look & Feel

Admin Screenshot from 2024-10-24 12-49-40 Admin Reader Screenshot from 2024-10-24 12-50-54

How to test

  1. Log in as an admin reader
  2. visit the user's page
  3. click on a user
  4. you should see only one button at the top left of the screen, which should be the reset password button

Further Improvements

None

Related Items

This PR closes: #1185


  • [x] I agree to contribute to the project under Apache 2 License.
  • [x] To the best of my knowledge, the proposed patch is not based on code under GPL or other license that is incompatible with FlexMeasures

joshuaunity avatar Oct 24 '24 11:10 joshuaunity

@nhoening should we take this opportunity to also stop displaying the button to reset another user's password if you are an admin-reader?

Flix6x avatar Oct 24 '24 12:10 Flix6x

Yes. Good point.

Also, do you agree we could as a follow-up issue hard-code a list of supported roles? Could also already be done in this PR. We can give them capitalized constants, just like the permission in auth.

This is a preparation for editing users in the UI and giving them roles there, as well.

nhoening avatar Oct 24 '24 12:10 nhoening

Also, do you agree we could as a follow-up issue hard-code a list of supported roles? Could also already be done in this PR. We can give them capitalized constants, just like the permission in auth.

This is a preparation for editing users in the UI and giving them roles there, as well.

Let's handle that separately, and we can discuss in a new Issue.

Flix6x avatar Oct 24 '24 13:10 Flix6x