Skip to content

Commit

Permalink
Merge pull request #516 from sbesson/myaccount_sudoerId
Browse files Browse the repository at this point in the history
Handle sudo connection in the account view
  • Loading branch information
knabar authored Dec 19, 2023
2 parents e061604 + c313145 commit 9b9de7e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 4 additions & 3 deletions omeroweb/webadmin/templates/webadmin/myaccount.html
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,11 @@
</div>


<form class="standard_form settings_form" action="{% url 'wamyaccount' "save" %}" method="POST">{% csrf_token %}
<form class="standard_form settings_form" action="{% url 'wamyaccount' "save" %}" method="POST"
{% if isSudo %} inert {% endif %}
>{% csrf_token %}

<div id="personal_details">
<div id="personal_details" {% if isSudo %} style="opacity: 50%;" {% endif %}>

{% for field in form %}
{% if field.errors %}<div style="clear:both">{{ field.errors }}</div>{% endif %}
Expand All @@ -308,7 +310,6 @@
</div>
{% endif %}


<input type="submit" value="{% trans 'Save' %}" />
</div>
<div style="clear:both"></div>
Expand Down
2 changes: 2 additions & 0 deletions omeroweb/webadmin/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1037,6 +1037,7 @@ def my_account(request, action=None, conn=None, **kwargs):
isLdapUser,
hasAvatar,
) = prepare_experimenter(conn)
isSudo = conn.getEventContext().sudoerId is not None
try:
defaultGroupId = defaultGroup.id
except Exception:
Expand Down Expand Up @@ -1092,6 +1093,7 @@ def my_account(request, action=None, conn=None, **kwargs):
context = {
"form": form,
"ldapAuth": isLdapUser,
"isSudo": isSudo,
"experimenter": experimenter,
"ownedGroups": ownedGroups,
"password_form": password_form,
Expand Down

0 comments on commit 9b9de7e

Please sign in to comment.