From f52605284e390f4c5d9f5d84548e3a5d1b778b9f Mon Sep 17 00:00:00 2001
From: Tanner Prestegard <tanner.prestegard@ligo.org>
Date: Wed, 17 Oct 2018 14:32:51 -0500
Subject: [PATCH] Make subject of X509Cert longer

Some X509 certificate subjects which were obtained from the LIGO
LDAP were being truncated upon insertion into the database since
they were longer than the upper limit imposed here of 200 characters.
I asked the LIGO auth team for guidance as to whether there is any
kind of upper limit imposed at that level, but did not receive any
feedback.  So I am increasing it to 300 characters here and hoping
that is enough that we will never have to revisit this issue.  It will
also be necessary to clean up any certificates in the database which
are truncated.
---
 .../0014_x509cert_subject_longer.py           | 20 +++++++++++++++++++
 gracedb/ligoauth/models.py                    |  2 +-
 2 files changed, 21 insertions(+), 1 deletion(-)
 create mode 100644 gracedb/ligoauth/migrations/0014_x509cert_subject_longer.py

diff --git a/gracedb/ligoauth/migrations/0014_x509cert_subject_longer.py b/gracedb/ligoauth/migrations/0014_x509cert_subject_longer.py
new file mode 100644
index 000000000..c7cedb58f
--- /dev/null
+++ b/gracedb/ligoauth/migrations/0014_x509cert_subject_longer.py
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.16 on 2018-10-17 19:32
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('ligoauth', '0013_make_gstlal-spiir-gpu_robotuser'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='x509cert',
+            name='subject',
+            field=models.CharField(max_length=300),
+        ),
+    ]
diff --git a/gracedb/ligoauth/models.py b/gracedb/ligoauth/models.py
index 4b2698184..55e6a5b91 100644
--- a/gracedb/ligoauth/models.py
+++ b/gracedb/ligoauth/models.py
@@ -63,7 +63,7 @@ class RobotUser(User):
     pass
 
 class X509Cert(models.Model):
-    subject = models.CharField(max_length=200)
+    subject = models.CharField(max_length=300)
     users = models.ManyToManyField(User)
 
 class AlternateEmail(models.Model):
-- 
GitLab