Forked from
IGWN Computing and Software / GraceDB / GraceDB Server
1519 commits behind the upstream repository.
-
Tanner Prestegard authored
Created the 'access_managers' and 'superevent_managers' groups. These groups will be given appropriate permissions for managing external access to gracedb and creating/updating superevents, respectively.
Tanner Prestegard authoredCreated the 'access_managers' and 'superevent_managers' groups. These groups will be given appropriate permissions for managing external access to gracedb and creating/updating superevents, respectively.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
0016_create_access_and_superevent_groups.py 1.12 KiB
# -*- coding: utf-8 -*-
# Generated by Django 1.11.14 on 2018-08-02 18:33
# Create new groups for managing external access to superevents
# and for allowing non-Test superevent creation and update. We
# also add users to those groups
from __future__ import unicode_literals
from django.db import migrations
GROUPS = {
'access_managers': [],
'superevent_managers': ['emfollow'],
}
def add_groups(apps, schema_editor):
Group = apps.get_model('auth', 'Group')
User = apps.get_model('auth', 'User')
for group_name, usernames in GROUPS.iteritems():
g, _ = Group.objects.get_or_create(name=group_name)
users = User.objects.filter(username__in=usernames)
g.user_set.add(*users)
def remove_groups(apps, schema_editor):
Group = apps.get_model('auth', 'Group')
User = apps.get_model('auth', 'User')
for group_name in GROUPS:
g = Group.objects.get(name=group_name)
g.delete()
class Migration(migrations.Migration):
dependencies = [
('auth', '0015_update_emfollow_accounts'),
]
operations = [
migrations.RunPython(add_groups, remove_groups),
]