Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Jonah Kanner
gracedb
Commits
a374e102
Commit
a374e102
authored
Mar 01, 2019
by
Tanner Prestegard
Committed by
GraceDB
Mar 01, 2019
Browse files
Bugfix to a few migrations for creating robot accounts
Previously forgot to add deepclean and gwhen robot users to the LVC group.
parent
bca81cc8
Changes
2
Hide whitespace changes
Inline
Side-by-side
gracedb/ligoauth/migrations/0021_create_deepclean_account_and_certs.py
View file @
a374e102
...
...
@@ -2,6 +2,7 @@
# Generated by Django 1.11.16 on 2019-01-04 18:39
from
__future__
import
unicode_literals
from
django.conf
import
settings
from
django.db
import
migrations
ACCOUNT
=
{
...
...
@@ -20,10 +21,15 @@ CERTS = [
def
create_account_and_certs
(
apps
,
schema_editor
):
RobotUser
=
apps
.
get_model
(
'ligoauth'
,
'RobotUser'
)
X509Cert
=
apps
.
get_model
(
'ligoauth'
,
'X509Cert'
)
Group
=
apps
.
get_model
(
'auth'
,
'Group'
)
# Create user
user
=
RobotUser
.
objects
.
create
(
**
ACCOUNT
)
# Add user to LVC group
group
=
Group
.
objects
.
get
(
name
=
settings
.
LVC_GROUP
)
group
.
user_set
.
add
(
user
)
# Create X509 certificates
for
subject
in
CERTS
:
user
.
x509cert_set
.
create
(
subject
=
subject
)
...
...
gracedb/ligoauth/migrations/0024_create_gwhen_account_and_certs.py
View file @
a374e102
...
...
@@ -2,6 +2,7 @@
# Generated by Django 1.11.18 on 2019-02-18 19:50
from
__future__
import
unicode_literals
from
django.conf
import
settings
from
django.db
import
migrations
ACCOUNT
=
{
...
...
@@ -19,10 +20,15 @@ CERTS = [
def
create_account_and_certs
(
apps
,
schema_editor
):
RobotUser
=
apps
.
get_model
(
'ligoauth'
,
'RobotUser'
)
X509Cert
=
apps
.
get_model
(
'ligoauth'
,
'X509Cert'
)
Group
=
apps
.
get_model
(
'auth'
,
'Group'
)
# Create user
user
=
RobotUser
.
objects
.
create
(
**
ACCOUNT
)
# Add user to LVC group
group
=
Group
.
objects
.
get
(
name
=
settings
.
LVC_GROUP
)
group
.
user_set
.
add
(
user
)
# Create X509 certificates
for
subject
in
CERTS
:
user
.
x509cert_set
.
create
(
subject
=
subject
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment