Show if user is also a POSIX user in edit user form.

This commit is contained in:
James Valleroy authored and Sunil Mohan Adapa committed 2015-01-20 12:37:16 +05:30
1 parent 45b5ce8de9
commit 2da8619248
3 files changed
+40

No files matched your search

@@ -46,6 +46,11 @@
{{ form|bootstrap }}
{% if is_posix_user %}
<p>This user is also a POSIX user and (if active) can log in to the
system through SSH.</p>
{% endif %}
<input type="submit" class="btn btn-primary" value="Save Changes"/>
</form>
+7
View File
@@ -26,6 +26,7 @@ from django.views.generic import ListView
from gettext import gettext as _
from .forms import CreateUserForm, UserUpdateForm, UserChangePasswordForm
from plinth import actions
subsubmenu = [{'url': reverse_lazy('users:index'),
@@ -70,6 +71,12 @@ class UserUpdate(ContextMixin, SuccessMessageMixin, UpdateView):
success_message = _('User %(username)s updated.')
title = _('Edit User')
def get_context_data(self, **kwargs):
context = super(UserUpdate, self).get_context_data(**kwargs)
output = actions.run('check-user-exists', [self.object.username])
context['is_posix_user'] = 'User exists' in output
return context
def get_success_url(self):
"""Return the URL to redirect to in case of successful updation."""
return reverse('users:edit', kwargs={'slug': self.object.username})