Skip to content
Snippets Groups Projects
Commit 4e63cc0b authored by Tanner Prestegard's avatar Tanner Prestegard Committed by GraceDB
Browse files

Add new robot certificates for 'emfollow' account

parent 38632f93
No related branches found
No related tags found
No related merge requests found
# -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-03-01 14:37
from __future__ import unicode_literals
from django.db import migrations
USERNAME = 'emfollow'
NEW_CERTS = [
'/DC=org/DC=cilogon/C=US/O=LIGO/OU=Robots/CN=emfollow.ligo.caltech.edu/CN=emfollow/CN=Leo Singer/CN=UID:leo.singer.robot',
'/DC=org/DC=cilogon/C=US/O=LIGO/OU=Robots/CN=emfollow.ligo-la.caltech.edu/CN=emfollow-la/CN=Leo Singer/CN=UID:leo.singer.robot',
'/DC=org/DC=cilogon/C=US/O=LIGO/OU=Robots/CN=emfollow.ligo-wa.caltech.edu/CN=emfollow-wa/CN=Leo Singer/CN=UID:leo.singer.robot',
'/DC=org/DC=cilogon/C=US/O=LIGO/OU=Robots/CN=emfollow.ligo.caltech.edu/CN=emfollow-playground/CN=Leo Singer/CN=UID:leo.singer.robot',
'/DC=org/DC=cilogon/C=US/O=LIGO/OU=Robots/CN=emfollow.ligo-la.caltech.edu/CN=emfollow-playground-la/CN=Leo Singer/CN=UID:leo.singer.robot',
'/DC=org/DC=cilogon/C=US/O=LIGO/OU=Robots/CN=emfollow.ligo-wa.caltech.edu/CN=emfollow-playground-wa/CN=Leo Singer/CN=UID:leo.singer.robot',
]
def update_certs(apps, schema_editor):
RobotUser = apps.get_model('ligoauth', 'RobotUser')
# Get user
user = RobotUser.objects.get(username=USERNAME)
# Create new certificates for user
for cert in NEW_CERTS:
user.x509cert_set.create(subject=cert)
def revert_certs(apps, schema_editor):
RobotUser = apps.get_model('ligoauth', 'RobotUser')
# Get user
user = RobotUser.objects.get(username=USERNAME)
# Delete certificates for user
for cert in NEW_CERTS:
user.x509cert_set.get(subject=cert).delete()
class Migration(migrations.Migration):
dependencies = [
('ligoauth', '0024_create_gwhen_account_and_certs'),
]
operations = [
migrations.RunPython(update_certs, revert_certs),
]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment