Forked from
IGWN Computing and Software / GraceDB / GraceDB Server
1002 commits behind the upstream repository.
-
Tanner Prestegard authored
Create a group for the RAVEN pipeline, add users, and give the group specific permissions. Right now, they are just allowed to populate the Fermi, SNEWS, and Swift pipelines for uploading external events.
Tanner Prestegard authoredCreate a group for the RAVEN pipeline, add users, and give the group specific permissions. Right now, they are just allowed to populate the Fermi, SNEWS, and Swift pipelines for uploading external events.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
0022_populate_raven_users_group.py 1.01 KiB
# -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-05-08 16:22
from __future__ import unicode_literals
from django.db import migrations
GROUP_NAME = 'raven_users'
USERS = [
'brandon.piotrzkowski@LIGO.ORG',
]
def add_users(apps, schema_editor):
Group = apps.get_model('auth', 'Group')
User = apps.get_model('auth', 'User')
# Get group
pg = Group.objects.get(name=GROUP_NAME)
# Get users
users = User.objects.filter(username__in=USERS)
# Add users
pg.user_set.add(*users)
def remove_users(apps, schema_editor):
Group = apps.get_model('auth', 'Group')
User = apps.get_model('auth', 'User')
# Get group
pg = Group.objects.get(name=GROUP_NAME)
# Get users
users = User.objects.filter(username__in=USERS)
# Remove users
pg.user_set.remove(*users)
class Migration(migrations.Migration):
dependencies = [
('auth', '0021_create_raven_users_group'),
]
operations = [
migrations.RunPython(add_users, remove_users),
]