Example #1
0
 def clean(self, group):
     if not self.required and group in ('-----', ''):
         return None
     if FreeNAS_Group(group, flags=FLAGS_DBINIT) == None:
         raise forms.ValidationError(
             _("The group %s is not valid.") % group)
     return group
Example #2
0
 def get_group_object(self, groupname):
     group = False
     try:
         group = FreeNAS_Group(groupname)
     except Exception:
         pass
     return group
Example #3
0
 def prepare_value(self, value):
     rv = super(GroupField, self).prepare_value(value)
     if rv:
         try:
             FreeNAS_Group(rv, flags=FLAGS_DBINIT)
         except:
             rv = 'nobody'
     return rv
Example #4
0
 def prepare_value(self, value):
     rv = super(GroupField, self).prepare_value(value)
     group = FreeNAS_Group(rv)
     if rv and not group:
         return 'nobody'
     return rv