Skip to content

Commit

Permalink
work on getting sso working and also db creds
Browse files Browse the repository at this point in the history
  • Loading branch information
nboyse committed Nov 28, 2024
1 parent aadd58c commit 5a5eec3
Show file tree
Hide file tree
Showing 13 changed files with 302 additions and 34 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ safe: ##

.PHONY: check-migrations
check-migrations: stop ## Check types in redbox and worker
docker compose up -d --wait db minio elasticsearch
docker compose up -d --wait db minio opensearch
cd django_app && poetry run python manage.py migrate
cd django_app && poetry run python manage.py makemigrations --check

Expand Down
56 changes: 54 additions & 2 deletions django_app/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions django_app/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ pandas = "^2.2.2"
django-waffle = "^4.1.0"
opensearch-py = "^2.7.1"
scikit-learn = "^1.5.2"
django-staff-sso-client = "^4.3.0"

[tool.poetry.group.dev.dependencies]
pytest = "^8.3.2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ class Migration(migrations.Migration):
]

operations = [
migrations.AddField(
model_name='citation',
name='text_in_answer',
field=models.TextField(blank=True, null=True),
),
# migrations.AddField(
# model_name='citation',
# name='text_in_answer',
# field=models.TextField(blank=True, null=True),
# ),
]
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ class Migration(migrations.Migration):
]

operations = [
migrations.AlterField(
model_name='citation',
name='text_in_answer',
field=models.TextField(blank=True, help_text='the part of the answer the citation refers too - useful for adding in footnotes', null=True),
),
# migrations.AlterField(
# model_name='citation',
# name='text_in_answer',
# field=models.TextField(blank=True, help_text='the part of the answer the citation refers too - useful for adding in footnotes', null=True),
# ),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Generated by Django 5.1.3 on 2024-11-26 14:01

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("redbox_core", "0069_alter_citation_source"),
]

operations = [
migrations.AlterModelOptions(
name="user",
options={"verbose_name": "user", "verbose_name_plural": "users"},
),
migrations.AlterModelManagers(
name="user",
managers=[],
),
migrations.AlterField(
model_name="user",
name="email",
field=models.EmailField(max_length=254, unique=True),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Custom generated migration will need to be amended for contribution back to i.ai

import redbox_app.redbox_core.models
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("redbox_core", "0070_alter_user_options_alter_user_managers_and_more"),
]

operations = [
migrations.AddField(
model_name="user",
name="username",
field=models.EmailField(
max_length=254, null=True
),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Custom generated migration will need to be amended for contribution back to i.ai

import redbox_app.redbox_core.models
from django.db import migrations, models


# Custom generated migration will need to be amended for contribution back to i.ai

import logging
logger = logging.getLogger(__name__)


def populate_existing_users_username(apps, schema_editor):
users = redbox_app.redbox_core.models.User.objects.all()

for user in users:
user.username = user.email
user.save(update_fields=["username"])

class Migration(migrations.Migration):

dependencies = [
("redbox_core", "0071_create_username_field"),
]

operations = [
migrations.RunPython(populate_existing_users_username, reverse_code=migrations.RunPython.noop),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Generated by Django 5.1.3 on 2024-11-27 11:09

import redbox_app.redbox_core.models
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("auth", "0012_alter_user_first_name_max_length"),
("redbox_core", "0072_populate_username_values"),
]

operations = [
migrations.AlterField(
model_name="user",
name="username",
field=models.EmailField(
max_length=254, unique=True, default="default@default.com"
),
),
migrations.AlterModelOptions(
name="user",
options={},
),
migrations.AlterModelManagers(
name="user",
managers=[
("objects", redbox_app.redbox_core.models.SSOUserManager()),
],
),
migrations.RemoveField(
model_name="user",
name="date_joined",
),
migrations.RemoveField(
model_name="user",
name="first_name",
),
migrations.RemoveField(
model_name="user",
name="last_name",
),
migrations.AlterField(
model_name="user",
name="groups",
field=models.ManyToManyField(
blank=True,
related_name="sso_user_set",
to="auth.group",
verbose_name="groups",
),
),
migrations.AlterField(
model_name="user",
name="is_active",
field=models.BooleanField(default=True),
),
migrations.AlterField(
model_name="user",
name="is_staff",
field=models.BooleanField(default=False),
),
migrations.AlterField(
model_name="user",
name="is_superuser",
field=models.BooleanField(default=False),
),
migrations.AlterField(
model_name="user",
name="user_permissions",
field=models.ManyToManyField(
blank=True,
related_name="sso_user_set",
to="auth.permission",
verbose_name="user permissions",
),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Generated by Django 5.1.3 on 2024-11-27 13:58

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("redbox_core", "0073_alter_user_options_alter_user_managers_and_more"),
]

operations = [
migrations.AddField(
model_name="user",
name="first_name",
field=models.CharField(default="default", max_length=48),
preserve_default=False,
),
migrations.AddField(
model_name="user",
name="last_name",
field=models.CharField(default="default", max_length=48),
preserve_default=False,
),
]
Loading

0 comments on commit 5a5eec3

Please sign in to comment.