Skip to content

Commit

Permalink
Display deactivate btn only as admin/account-admin (FlexMeasures#1220)
Browse files Browse the repository at this point in the history
* fix: only display deactivate btn if user is admin

Signed-off-by: joshuaunity <[email protected]>

* chore: expanded conditional coverage and added to changelog

Signed-off-by: joshuaunity <[email protected]>

* chore: modified changelog

Signed-off-by: joshuaunity <[email protected]>

---------

Signed-off-by: joshuaunity <[email protected]>
Co-authored-by: Nicolas Höning <[email protected]>
  • Loading branch information
joshuaunity and nhoening authored Oct 27, 2024
1 parent 8914e47 commit 1119bad
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions documentation/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Bugfixes
* The UI footer now stays at the bottom even on pages with little content [see `PR #1204 <https://github.com/FlexMeasures/flexmeasures/pull/1204>`_]
* Correct stroke dash (based on source type) for forecasts made by forecasters included in FlexMeasures [see `PR #1211 <https://www.github.com/FlexMeasures/flexmeasures/pull/1211>`_]
* Show the correct UTC offset for the data's time span as shown under sensor stats in the UI [see `PR #1213 <https://github.com/FlexMeasures/flexmeasures/pull/1213>`_]
* Fix issue with displaying ``deactivate user`` and ``reset password`` buttons for non admin users [see `PR #1220 <https://github.com/FlexMeasures/flexmeasures/pull/1220>`_]


v0.23.0 | September 18, 2024
Expand Down
2 changes: 2 additions & 0 deletions flexmeasures/ui/templates/crud/user.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<div class="row">
<div class="col-md-2 on-top-md">
<div class="header-action-button">
{% if current_user.has_role('admin') or current_user.has_role('account-admin') %}
<div class="">
<form action="/users/toggle_active/{{ user.id }}" method="get">
<button class="btn btn-sm btn-responsive {% if user.active %} btn-warning {% else %} btn-success {% endif %} delete-button mb-3" type="submit" title="Toggle activation status of this user.">
Expand All @@ -25,6 +26,7 @@
title="Reset the password and send instructions how to choose a new one.">Reset password</button>
</form>
</div>
{% endif %}
</div>
</div>
<div class="col-md-8">
Expand Down

0 comments on commit 1119bad

Please sign in to comment.