Esempio n. 1
0
def get_default_user_group(**kwargs):
  default_user_group = DEFAULT_USER_GROUP.get()
  if default_user_group is None:
    return None

  if ENABLE_ORGANIZATIONS.get():
    group, created = Group.objects.get_or_create(name=default_user_group, organization=default_organization())
  else:
    group, created = Group.objects.get_or_create(name=default_user_group)

  if created:
    group.save()

  return group
Esempio n. 2
0
def get_default_user_group(**kwargs):
    default_user_group = DEFAULT_USER_GROUP.get()
    if default_user_group is None:
        return None

    attributes = {'name': default_user_group}
    if ENABLE_ORGANIZATIONS.get() and kwargs.get('user'):
        attributes['organization'] = kwargs['user'].organization

    group, created = Group.objects.get_or_create(**attributes)

    if created:
        group.save()

    return group