Assistant: codex Assistant-Model: gpt-6-astra Assistant-Session: 01a092fe-13b1-7f12-ac74-7d258af4d79c
35 lines
1.3 KiB
Python
35 lines
1.3 KiB
Python
from django.contrib.auth.models import AbstractUser
|
|
from django.db import models
|
|
|
|
|
|
class Mitarbeiter(AbstractUser):
|
|
ROLLE_CHOICES = [
|
|
('bid_manager', 'Bid Manager'),
|
|
('fachexperte', 'Fachverantwortlicher'),
|
|
('vertrieb', 'Vertrieb / Account Management'),
|
|
('pricing', 'Pricing / Controlling'),
|
|
('recht', 'Recht / Compliance'),
|
|
('geschaeftsfuehrung', 'Geschäftsführung'),
|
|
('projektleitung', 'Projektleitung Umsetzung'),
|
|
('admin', 'Administrator'),
|
|
]
|
|
rolle = models.CharField(max_length=30, choices=ROLLE_CHOICES, blank=True)
|
|
mobilnummer = models.CharField(max_length=50, blank=True)
|
|
organisationseinheit = models.CharField(max_length=200, blank=True)
|
|
|
|
def __str__(self):
|
|
return self.get_full_name() or self.username
|
|
|
|
class Meta:
|
|
verbose_name = 'Mitarbeiter'
|
|
verbose_name_plural = 'Mitarbeiter'
|
|
|
|
|
|
class OIDCIdentity(models.Model):
|
|
issuer = models.CharField(max_length=512)
|
|
subject = models.CharField(max_length=512)
|
|
user = models.OneToOneField(Mitarbeiter, on_delete=models.PROTECT)
|
|
|
|
class Meta:
|
|
constraints = [models.UniqueConstraint(fields=['issuer', 'subject'],
|
|
name='unique_oidc_identity')]
|