From 4dc83f135a1ea673d19c6964e007465c39a10f83 Mon Sep 17 00:00:00 2001 From: James Valleroy Date: Tue, 26 Jun 2018 21:41:34 -0400 Subject: [PATCH] users: Update Change Password menu for non-admin users Don't show Create User menu item to non-admin users. Previously this was fixed for the Edit User page, and this fixes it also for the Change Password page. Signed-off-by: James Valleroy --- plinth/modules/users/views.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plinth/modules/users/views.py b/plinth/modules/users/views.py index bd72bd2b0..c2904a56c 100644 --- a/plinth/modules/users/views.py +++ b/plinth/modules/users/views.py @@ -201,6 +201,13 @@ class UserChangePassword(ContextMixin, SuccessMessageMixin, FormView): update_session_auth_hash(self.request, form.user) return super(UserChangePassword, self).form_valid(form) + def get_context_data(self, **kwargs): + """Remove subsubmenu for non-admin users.""" + context = super(UserChangePassword, self).get_context_data(**kwargs) + if not is_user_admin(self.request): + del context['subsubmenu'] + return context + class FirstBootView(django.views.generic.CreateView): """Create user account and log the user in."""