Maintenance will be performed on git.ligo.org, chat.ligo.org, containers.ligo.org, and docs.ligo.org on Tuesday 26 May 2020 starting at approximately 10am CDT. It is expected to take around 30 minutes and will involve a short period of downtime, around 5 minutes, towards the end of the maintenance period. Please address any questions, comments, or concerns to uwm-help@cgca.uwm.edu.

Commit 120c0617 authored by Tanner Prestegard's avatar Tanner Prestegard Committed by GraceDB

ligoauth: create authgroup for grb managers

Users in this group have permission to "T90", or update certain
parameters of GrbEvents in GraceDB
parent 695d3d25
# -*- coding: utf-8 -*-
# Generated by Django 1.11.23 on 2019-08-09 18:21
from __future__ import unicode_literals
from django.db import migrations
AUTHGROUP_INFO = {
'name': 'grb_managers',
'description': ('LIGO/Virgo members in the GRB subgroup who have '
'permission to update external GRB events in GraceDB'),
}
def create_authgroup(apps, schema_editor):
AuthGroup = apps.get_model('ligoauth', 'AuthGroup')
Permission = apps.get_model('auth', 'Permission')
# Create AuthGroup
ag = AuthGroup.objects.create(**AUTHGROUP_INFO)
# Get permissions for "T90"-ing a grbevent
perm = Permission.objects.get(
content_type__app_label='events',
codename='t90_grbevent'
)
# *IMPORTANT*: clear all current users who have this
# permission. It should only be assigned to groups
# going forward.
perm.user_set.clear()
# Add this permission to the new AuthGroup
ag.permissions.add(perm)
def delete_authgroup(apps, schema_editor):
AuthGroup = apps.get_model('ligoauth', 'AuthGroup')
# Delete AuthGroup
ag = AuthGroup.objects.get(name=AUTHGROUP_INFO['name'])
ag.delete()
class Migration(migrations.Migration):
dependencies = [
('ligoauth', '0049_update_access_managers_membership'),
]
operations = [
migrations.RunPython(create_authgroup, delete_authgroup),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-08-08 18:27
from __future__ import unicode_literals
from django.db import migrations
GROUP_NAME = 'grb_managers'
USERS = [
'robert.coyne@LIGO.ORG',
'ryan.fisher@LIGO.ORG',
'francesco.pannarale@LIGO.ORG',
'jordan.palamos@LIGO.ORG',
'ronaldas.macas@LIGO.ORG',
'andrew.williamson@LIGO.ORG',
'iain.dorrington@LIGO.ORG',
]
def add_users(apps, schema_editor):
AuthGroup = apps.get_model('ligoauth', 'AuthGroup')
User = apps.get_model('auth', 'User')
group = AuthGroup.objects.get(name=GROUP_NAME)
for username in USERS:
user, _ = User.objects.get_or_create(username=username)
group.user_set.add(user)
class Migration(migrations.Migration):
dependencies = [
('ligoauth', '0050_create_grb_managers_authgroup'),
]
operations = [
migrations.RunPython(add_users, migrations.RunPython.noop),
]
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