diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-12-06 19:35:18 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-07-08 09:58:49 +0200 |
commit | d1b9918e9749abbbb4953d84e07b9ae07fb56968 (patch) | |
tree | 38f70b627ec2234ad514620d673c7304d03c751f | |
parent | 9367bc912631aa50acec75b1804bb13dcef2bad4 (diff) | |
download | Ishtar-d1b9918e9749abbbb4953d84e07b9ae07fb56968.tar.bz2 Ishtar-d1b9918e9749abbbb4953d84e07b9ae07fb56968.zip |
Person - manage account action: fix redirection (refs #5216)
-rw-r--r-- | ishtar_common/models.py | 8 | ||||
-rw-r--r-- | ishtar_common/urls.py | 5 | ||||
-rw-r--r-- | ishtar_common/views.py | 6 |
3 files changed, 13 insertions, 6 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 74d81281d..c46aad6c1 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -2914,13 +2914,13 @@ class Person(Address, Merge, OwnPerms, ValueGetter, MainItem): def get_extra_actions(self, request): actions = super(Person, self).get_extra_actions(request) - can_create_person = self.can_do(request, "change_person") - if not can_create_person: + # for admin only + if not request.user.is_staff: return actions actions += [ ( - reverse("account_management", args=[self.pk]), - _("Create new account"), + reverse("account-manage", args=[self.pk]), + _("Manage account"), "fa fa-user", "", "", diff --git a/ishtar_common/urls.py b/ishtar_common/urls.py index 9e120a945..4f4d5ee4b 100644 --- a/ishtar_common/urls.py +++ b/ishtar_common/urls.py @@ -197,6 +197,11 @@ urlpatterns = [ name="account_management", ), url( + r"account_manage/(?P<pk>\d+)$", + views.account_manage, + name="account-manage", + ), + url( r"account_deletion/(?P<step>.+)?$", check_rights(["add_ishtaruser"])(views.account_deletion_wizard), name="account_deletion", diff --git a/ishtar_common/views.py b/ishtar_common/views.py index 9b7e8d5e2..c87769a5b 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -316,8 +316,10 @@ account_deletion_wizard = wizards.IshtarUserDeletionWizard.as_view( url_name="account_deletion", ) -def account_create(request, pk): - if not wizard_is_available(account_management_wizard, request, models.IshtarUser): + +def account_manage(request, pk): + if not wizard_is_available(account_management_wizard, request, models.IshtarUser, + pk): return HttpResponseRedirect("/") wizards.AccountWizard.session_set_value( request, "selec-account_management", "pk", pk, reset=True |