Skip to content

Commit

Permalink
Merge pull request #41 from ImperialCollegeLondon/uxid
Browse files Browse the repository at this point in the history
Add model for unix uid
  • Loading branch information
cc-a authored Nov 21, 2024
2 parents fbf62eb + 93f1a56 commit 51e46ff
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
24 changes: 24 additions & 0 deletions imperial_coldfront_plugin/migrations/0002_unixuid.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by Django 4.2.11 on 2024-11-21 14:41

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('imperial_coldfront_plugin', '0001_initial'),
]

operations = [
migrations.CreateModel(
name='UnixUID',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('identifier', models.IntegerField()),
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='user_id', to=settings.AUTH_USER_MODEL)),
],
),
]
21 changes: 21 additions & 0 deletions imperial_coldfront_plugin/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,24 @@ class GroupMembership(models.Model):
on_delete=models.CASCADE,
related_name="group_memberships_set",
)


class UnixUID(models.Model):
"""Identity data to map a user to a unique identifier.
This model stores a unique identifier for each user, which can be used to
identify users in external systems. The identifier is an integer value that
is unique to each user user.
Attributes:
user (OneToOneField): A reference to the user, connected to AUTH_USER_MODEL.
Deletes the related identifier when the user is deleted.
identifier (IntegerField): A unique identifier for the user.
"""

user = models.OneToOneField(
settings.AUTH_USER_MODEL,
on_delete=models.CASCADE,
related_name="user_id",
)
identifier = models.IntegerField()

0 comments on commit 51e46ff

Please sign in to comment.