From 80ee7f3d4b5aa43f9896d396143c5da52958816d Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Mon, 27 Dec 2021 00:35:20 -0800 Subject: [PATCH] fix(routers.accounts): use User.can_edit_user across the board Signed-off-by: Kevin Morris --- aurweb/routers/accounts.py | 2 +- templates/account/show.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/aurweb/routers/accounts.py b/aurweb/routers/accounts.py index 6472ccae..4e0ce33b 100644 --- a/aurweb/routers/accounts.py +++ b/aurweb/routers/accounts.py @@ -341,7 +341,7 @@ def cannot_edit(request: Request, user: models.User) \ :param user: Target user to be edited :return: RedirectResponse if approval != granted else None """ - approved = request.user.has_credential(creds.ACCOUNT_EDIT, approved=[user]) + approved = request.user.can_edit_user(user) if not approved and (to := "/"): if user: to = f"/account/{user.Username}" diff --git a/templates/account/show.html b/templates/account/show.html index c6a53f4a..26cfbc21 100644 --- a/templates/account/show.html +++ b/templates/account/show.html @@ -86,7 +86,7 @@ | safe }} - {% if request.user.has_credential(creds.ACCOUNT_EDIT, approved=[user]) %} + {% if request.user.can_edit_user(user) %}
  • {{ "%sEdit this user's account%s" | tr