Commit 5706e906 authored by Maël Kervella's avatar Maël Kervella

Fix #117 : Use unix_name instead of name for ldap groups

A group in the LDAP now use the `unix_name` instead of the `name`
The `new_group` form has now a more logical order for the fields
The label for the `unix_name` is now more explicit
parent 40247e32
......@@ -501,7 +501,7 @@ class ShellForm(FormRevMixin, ModelForm):
class ListRightForm(FormRevMixin, ModelForm):
"""Edition, d'un groupe , équivalent à un droit
Ne peremet pas d'editer le gid, car il sert de primary key"""
Ne permet pas d'editer le gid, car il sert de primary key"""
permissions = forms.ModelMultipleChoiceField(
......@@ -510,23 +510,24 @@ class ListRightForm(FormRevMixin, ModelForm):
class Meta:
model = ListRight
fields = ['name', 'unix_name', 'critical', 'permissions', 'details']
fields = ('name', 'unix_name', 'critical', 'permissions', 'details')
def __init__(self, *args, **kwargs):
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
super(ListRightForm, self).__init__(*args, prefix=prefix, **kwargs)
self.fields['unix_name'].label = 'Nom du droit/groupe'
self.fields['unix_name'].label = 'Nom UNIX du groupe'
class NewListRightForm(ListRightForm):
"""Ajout d'un groupe/list de droit """
class Meta(ListRightForm.Meta):
fields = '__all__'
fields = ('name', 'unix_name', 'gid', 'critical', 'permissions',
def __init__(self, *args, **kwargs):
super(NewListRightForm, self).__init__(*args, **kwargs)
self.fields['gid'].label = 'Gid, attention, cet attribut ne doit\
pas être modifié après création'
self.fields['gid'].label = ("Gid, attention, cet attribut ne doit "
"pas être modifié après création")
class DelListRightForm(Form):
......@@ -1175,7 +1175,7 @@ class ListRight(RevMixin, AclMixin, Group):
group_ldap = LdapUserGroup.objects.get(gid=self.gid)
except LdapUserGroup.DoesNotExist:
group_ldap = LdapUserGroup(gid=self.gid) = self.listright = self.unix_name
group_ldap.members = [user.pseudo for user
in self.user_set.all()]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment