-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This works best if you trash your existing database. (We're early enough that that shouldn't be a big deal.) - Finalizing changes to the user model and squashing the users migrations down to one - Fixes for the APISIX middleware to check that the user is active, create the user properly when it has to - Set a default for global_id - if we create a manual user, the field needs to be populated, and it's a UUID so no harm in just filling it as per usual - Update the docker_compose env to actually put the Postgres database in a persistent volume, imagine that! - Update the docker_compose env to pull in an init script for Keycloak so you don't have to manually do it - Update the Dockerfile to pull in mitol_django packages you might have built and added manually - no changes to the pyproject.toml for this, you get to do that yourself still - Update gitignore to ignore the mitol_django manual packages
- Loading branch information
Showing
10 changed files
with
187 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -140,3 +140,6 @@ generated-codes.csv | |
|
||
# SQLite | ||
*.sqlite3 | ||
|
||
# Manually-built ol-django packages | ||
mitol_django_* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM python:3.12.6 | ||
FROM python:3.12 | ||
LABEL maintainer "ODL DevOps <[email protected]>" | ||
|
||
# Add package files, install updated node and pip | ||
|
@@ -32,6 +32,7 @@ RUN pip install "poetry==$POETRY_VERSION" | |
# Install project packages | ||
COPY pyproject.toml /src | ||
COPY poetry.lock /src | ||
COPY mitol_django_*.gz /src | ||
WORKDIR /src | ||
RUN poetry install | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
CREATE DATABASE keycloak; | ||
GRANT ALL PRIVILEGES ON DATABASE keycloak TO postgres; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
# Generated by Django 4.2.18 on 2025-02-04 14:15 | ||
|
||
import uuid | ||
|
||
import django.db.models.deletion | ||
import django_countries.fields | ||
from django.conf import settings | ||
from django.db import migrations, models | ||
|
||
import users.models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
initial = True | ||
|
||
dependencies = [ | ||
("auth", "0012_alter_user_first_name_max_length"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="User", | ||
fields=[ | ||
( | ||
"id", | ||
models.BigAutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("password", models.CharField(max_length=128, verbose_name="password")), | ||
( | ||
"last_login", | ||
models.DateTimeField( | ||
blank=True, null=True, verbose_name="last login" | ||
), | ||
), | ||
( | ||
"is_superuser", | ||
models.BooleanField( | ||
default=False, | ||
help_text="Designates that this user has all permissions without explicitly assigning them.", | ||
verbose_name="superuser status", | ||
), | ||
), | ||
("created_on", models.DateTimeField(auto_now_add=True)), | ||
("updated_on", models.DateTimeField(auto_now=True)), | ||
( | ||
"global_id", | ||
models.CharField( | ||
blank=True, | ||
default=uuid.uuid4, | ||
help_text="The SSO ID (usually a Keycloak UUID) for the user.", | ||
max_length=255, | ||
unique=True, | ||
), | ||
), | ||
("username", models.CharField(max_length=150, unique=True)), | ||
("email", models.EmailField(max_length=254, unique=True)), | ||
( | ||
"first_name", | ||
models.CharField(blank=True, default="", max_length=255), | ||
), | ||
("last_name", models.CharField(blank=True, default="", max_length=255)), | ||
("name", models.CharField(blank=True, default="", max_length=255)), | ||
( | ||
"is_staff", | ||
models.BooleanField( | ||
default=False, help_text="The user can access the admin site" | ||
), | ||
), | ||
( | ||
"is_active", | ||
models.BooleanField( | ||
default=False, help_text="The user account is active" | ||
), | ||
), | ||
( | ||
"groups", | ||
models.ManyToManyField( | ||
blank=True, | ||
help_text="The groups this user belongs to. A user will get all permissions granted to each of their groups.", | ||
related_name="user_set", | ||
related_query_name="user", | ||
to="auth.group", | ||
verbose_name="groups", | ||
), | ||
), | ||
( | ||
"user_permissions", | ||
models.ManyToManyField( | ||
blank=True, | ||
help_text="Specific permissions for this user.", | ||
related_name="user_set", | ||
related_query_name="user", | ||
to="auth.permission", | ||
verbose_name="user permissions", | ||
), | ||
), | ||
], | ||
options={ | ||
"abstract": False, | ||
}, | ||
managers=[ | ||
("objects", users.models.UserManager()), | ||
], | ||
), | ||
migrations.CreateModel( | ||
name="UserProfile", | ||
fields=[ | ||
( | ||
"id", | ||
models.BigAutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("created_on", models.DateTimeField(auto_now_add=True)), | ||
("updated_on", models.DateTimeField(auto_now=True)), | ||
("country_code", django_countries.fields.CountryField(max_length=2)), | ||
( | ||
"user", | ||
models.OneToOneField( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name="profile", | ||
to=settings.AUTH_USER_MODEL, | ||
), | ||
), | ||
], | ||
options={ | ||
"abstract": False, | ||
}, | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters