Commit 962da408 authored by Tanner Prestegard's avatar Tanner Prestegard Committed by GraceDB

ligoauth: add new X.509 certificate for emfollow acct

parent 1d2a1ea7
Pipeline #73748 passed with stages
in 12 minutes and 48 seconds
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-08-06 18:06
from __future__ import unicode_literals
from django.db import migrations
ACCOUNT = {
'name': 'emfollow',
'new_cert': '/DC=org/DC=cilogon/C=US/O=LIGO/OU=Robots/CN=emfollow-playground.ligo.caltech.edu/CN=emfollow-playground/CN=Leo Singer/CN=UID:leo.singer.robot'
}
def add_cert(apps, schema_editor):
User = apps.get_model('auth', 'User')
# Get user
user = User.objects.get(username=ACCOUNT['name'])
# Create new certificate
user.x509cert_set.create(subject=ACCOUNT['new_cert'])
def delete_cert(apps, schema_editor):
User = apps.get_model('auth', 'User')
# Get user
user = User.objects.get(username=ACCOUNT['name'])
# Delete new certificate
cert = user.x509cert_set.get(subject=ACCOUNT['new_cert'])
cert.delete()
class Migration(migrations.Migration):
dependencies = [
('ligoauth', '0046_delete_robotuser_model'),
]
operations = [
migrations.RunPython(add_cert, delete_cert),
]
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