feat: publish CodexPi contest snapshot
Some checks are pending
Qualité / tests (push) Waiting to run
Some checks are pending
Qualité / tests (push) Waiting to run
This commit is contained in:
25
django_ui/identity/models.py
Normal file
25
django_ui/identity/models.py
Normal file
@@ -0,0 +1,25 @@
|
||||
from django.conf import settings
|
||||
from django.db import models
|
||||
|
||||
APPLICATIONS = (
|
||||
"auto-care", "autonomous-dev-studio", "codex-commander", "knowledge-graph",
|
||||
"loutre-brain", "loutre-finance", "loutre-home", "loutre-os",
|
||||
"nasflix-ai-media-curator", "nasflix-media-health", "network-guardian",
|
||||
"pi-doctor", "print-pilot", "pwa-factory", "reverse-proxy-manager",
|
||||
"smart-inventory", "trip-organizer",
|
||||
)
|
||||
ROLES = ("reader", "operator", "admin")
|
||||
|
||||
|
||||
class ApplicationGrant(models.Model):
|
||||
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
|
||||
application = models.CharField(max_length=64, choices=[(name, name) for name in APPLICATIONS])
|
||||
role = models.CharField(max_length=16, choices=[(name, name) for name in ROLES])
|
||||
updated_at = models.DateTimeField(auto_now=True)
|
||||
|
||||
class Meta:
|
||||
constraints = [
|
||||
models.UniqueConstraint(fields=("user", "application"), name="identity_user_application"),
|
||||
models.CheckConstraint(condition=models.Q(application__in=APPLICATIONS), name="identity_known_application"),
|
||||
models.CheckConstraint(condition=models.Q(role__in=ROLES), name="identity_known_role"),
|
||||
]
|
||||
Reference in New Issue
Block a user