diff --git a/docs/admin_docs/source/robot_certificate.rst b/docs/admin_docs/source/robot_certificate.rst index 8cc84b3931cf24abc358ad7da2bb8fa5379728d5..d4cfb955893c90e87230d27803fc9c1b2be67033 100644 --- a/docs/admin_docs/source/robot_certificate.rst +++ b/docs/admin_docs/source/robot_certificate.rst @@ -103,13 +103,13 @@ Edit the migration to do what you want it to do. You could use this as a templat ] def create_robots(apps, schema_editor): - LocalUser = apps.get_model('ligoauth', 'LocalUser') + RobotUser = apps.get_model('ligoauth', 'RobotUser') X509Cert = apps.get_model('ligoauth', 'X509Cert') Group = apps.get_model('auth', 'Group') lvc_group = Group.objects.get(name=settings.LVC_GROUP) for entry in ROBOTS: - user, created = LocalUser.objects.get_or_create(username=entry['username']) + user, created = RobotUser.objects.get_or_create(username=entry['username']) if created: user.first_name = entry['first_name'] user.last_name = entry['last_name'] @@ -133,13 +133,13 @@ Edit the migration to do what you want it to do. You could use this as a templat lvc_group.user_set.add(user) def delete_robots(apps, schema_editor): - LocalUser = apps.get_model('ligoauth', 'LocalUser') + RobotUser = apps.get_model('ligoauth', 'RobotUser') X509Cert = apps.get_model('ligoauth', 'X509Cert') for entry in ROBOTS: for dn in entry['dns']: X509Cert.objects.get(subject=dn).delete() - LocalUser.objects.get(username=entry['username']).delete() + RobotUser.objects.get(username=entry['username']).delete() class Migration(migrations.Migration): diff --git a/gracedb/ligoauth/admin.py b/gracedb/ligoauth/admin.py index b76a0b5de497900f3e4a9949ed5afc4fad55c95a..d77a96cc410b3f8858282012f819ebfc71b41bcd 100644 --- a/gracedb/ligoauth/admin.py +++ b/gracedb/ligoauth/admin.py @@ -1,6 +1,6 @@ from django.contrib import admin -from .models import LocalUser, LigoLdapUser, X509Cert +from .models import RobotUser, LigoLdapUser, X509Cert class LigoLdapUserAdmin(admin.ModelAdmin): list_display = ['username', 'first_name', 'last_name'] @@ -10,6 +10,6 @@ class X509CertAdmin(admin.ModelAdmin): list_display = ['subject'] search_fields = ['subject'] -admin.site.register(LocalUser) +admin.site.register(RobotUser) admin.site.register(LigoLdapUser, LigoLdapUserAdmin) admin.site.register(X509Cert, X509CertAdmin) diff --git a/gracedb/ligoauth/migrations/0012_rename_localuser_to_robotuser.py b/gracedb/ligoauth/migrations/0012_rename_localuser_to_robotuser.py new file mode 100644 index 0000000000000000000000000000000000000000..1457d206baa59e991b156572d5f7cd9283728a81 --- /dev/null +++ b/gracedb/ligoauth/migrations/0012_rename_localuser_to_robotuser.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.16 on 2018-10-17 18:22 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('ligoauth', '0011_update_virgo_detchar_cert'), + ] + + operations = [ + migrations.RenameModel( + old_name='LocalUser', + new_name='RobotUser', + ), + ] diff --git a/gracedb/ligoauth/models.py b/gracedb/ligoauth/models.py index b64d6dc9f7c4cb991f90cc7e7a1286ea36139f5f..4b2698184e778706298fb6b8d15e68fd6dfc1be4 100644 --- a/gracedb/ligoauth/models.py +++ b/gracedb/ligoauth/models.py @@ -7,7 +7,7 @@ from django.contrib.auth.models import User # There seems to be a LOT of duplication here and I don't know # if that is good or bad. Normally, that seems bad... # -# The thing is, LigoLdapUser and LocalUser (and whatever we might add later) +# The thing is, LigoLdapUser and RobotUser (and whatever we might add later) # are actual entities that we want synched with the Django User, so they *are* # separate could conceivably have different first_name's, say, yet still refer # to the same (abstract) user entity. Not likely, and not initially, but @@ -58,7 +58,8 @@ class LigoLdapUser(User): return u"{0} {1}".format(self.first_name, self.last_name).encode('utf-8') -class LocalUser(User): +# Class for robot accounts +class RobotUser(User): pass class X509Cert(models.Model):