From fcc37a8e2837ffb5aa8a67a10f3f5c8b3f8f9a03 Mon Sep 17 00:00:00 2001 From: James Valleroy Date: Sun, 12 Jul 2015 18:23:28 -0400 Subject: [PATCH] Create initial django groups during first_boot. --- plinth/modules/first_boot/forms.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plinth/modules/first_boot/forms.py b/plinth/modules/first_boot/forms.py index 50233cb70..f83808682 100644 --- a/plinth/modules/first_boot/forms.py +++ b/plinth/modules/first_boot/forms.py @@ -23,6 +23,7 @@ from gettext import gettext as _ from plinth import actions from plinth.errors import ActionError from plinth.modules.config import config +from plinth.modules.users.forms import GROUP_CHOICES class State0Form(forms.ModelForm): @@ -81,8 +82,11 @@ than 63 characters in length.'), messages.error(self.request, _('Failed to add new user to admin group.')) - g = auth.models.Group.objects.create(name='admin') - g.user_set.add(user) + # create initial Django groups + for group_choice in GROUP_CHOICES: + auth.models.Group.objects.create(name=group_choice[0]) + admin_group = auth.models.Group.objects.get(name='admin') + admin_group.user_set.add(user) self.login_user()