Skip to content

Commit

Permalink
Fix editing for superadmin
Browse files Browse the repository at this point in the history
  • Loading branch information
kiblik committed Sep 12, 2024
1 parent 95453cc commit 3cc64f7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion dojo/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -2786,7 +2786,6 @@ class Meta:

def __init__(self, *args, **kwargs):
is_superuser = kwargs.pop("is_superuser", False)
logger.debug(f"is_superuser: {is_superuser}")
super().__init__(*args, **kwargs)
if not is_superuser: # Only superadmins can edit owner
self.fields["owner"].disabled = True # TODO: needs to be tested
Expand Down
4 changes: 2 additions & 2 deletions dojo/notifications/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ def get_form(
**kwargs: dict,
) -> NotificationsWebhookForm:
if request.method == "POST":
return NotificationsWebhookForm(request.POST, **kwargs)
return NotificationsWebhookForm(request.POST, is_superuser=request.user.is_superuser, **kwargs)
else:
return NotificationsWebhookForm(**kwargs)
return NotificationsWebhookForm(is_superuser=request.user.is_superuser, **kwargs)

def preprocess_request(self, request: HttpRequest):
# Check Webhook notifications are enabled
Expand Down

0 comments on commit 3cc64f7

Please sign in to comment.