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

Restrict Audit Log Button Visibility #1228

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

joshuaunity
Copy link
Contributor

@joshuaunity joshuaunity commented Oct 28, 2024

Description

Conditionally display audit log buttons based on user permissions

Look & Feel

As a Staff User
Screenshot from 2024-10-28 16-11-41

As an Admin User
Screenshot from 2024-10-28 16-16-31

How to test

  1. Login with any account(admin or staff)
  2. visit user detail page
  3. Depending on your permissions you will see the audit log buttons or only one

Further Improvements

None

Related Items

This PR closes: #1222


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

Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
@joshuaunity joshuaunity self-assigned this Oct 28, 2024
@joshuaunity
Copy link
Contributor Author

@nhoening the changelog entry for this, should it be a bugfix or feat?

@nhoening
Copy link
Contributor

@nhoening the changelog entry for this, should it be a bugfix or feat?

Bugfix, I think

Copy link
Contributor

@nhoening nhoening left a comment

Choose a reason for hiding this comment

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

Please check other templates where these buttons also exist, as well:

  • ui/templates/crud/account.html

I noticed that ui/templates/crud/user.html could have the button, but doesn't yet. Should we add it there?

flexmeasures/ui/views/logged_in_user.py Show resolved Hide resolved
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
@joshuaunity
Copy link
Contributor Author

Please check other templates where these buttons also exist, as well:

  • ui/templates/crud/account.html

I noticed that ui/templates/crud/user.html could have the button, but doesn't yet. Should we add it there?

I think it makes sense to add it to that page as well.

joshuaunity and others added 2 commits October 29, 2024 12:06
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
Signed-off-by: JDev <45713692+joshuaunity@users.noreply.github.com>
Copy link
Contributor

@nhoening nhoening left a comment

Choose a reason for hiding this comment

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

A small naming change.
We should make sure this is tested though, at least manually.

flexmeasures/ui/crud/accounts.py Outdated Show resolved Hide resolved
flexmeasures/ui/views/logged_in_user.py Outdated Show resolved Hide resolved
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
Copy link
Contributor

@nhoening nhoening left a comment

Choose a reason for hiding this comment

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

Thanks!

@nhoening nhoening added this to the 0.24.0 milestone Oct 31, 2024
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.

Don't show unauthorized users buttons for audit logs they cannot see
2 participants