mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-02-11 08:23:49 +00:00
users: Don't show Create User form to non-admin users
For non-admin users, the subsubmenu containing both Edit and Create forms is shown. Removed the subsubmenu so that only the update form is shown. Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
f0157f7d3e
commit
15c7202a6b
@ -123,6 +123,13 @@ class UserUpdate(ContextMixin, SuccessMessageMixin, UpdateView):
|
||||
"""Return the URL to redirect to in case of successful updation."""
|
||||
return reverse('users:edit', kwargs={'slug': self.object.username})
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
"""Use self.title and the module-level subsubmenu"""
|
||||
context = super(UserUpdate, self).get_context_data(**kwargs)
|
||||
if not is_user_admin(self.request):
|
||||
del context['subsubmenu']
|
||||
return context
|
||||
|
||||
|
||||
class UserDelete(ContextMixin, DeleteView):
|
||||
"""Handle deleting users, showing a confirmation dialog first.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user