АРХ - МЕЖПРОЕКТНАЯ КОММУНИКАЦИЯ: Plane OIDC mapping для существующего пользователя
This commit is contained in:
@@ -62,7 +62,7 @@ from .project import (
|
||||
from .session import Session
|
||||
from .social_connection import SocialLoginConnection
|
||||
from .state import State, StateGroup, DEFAULT_STATES
|
||||
from .user import Account, Profile, User, BotTypeEnum
|
||||
from .user import Account, ExternalIdentityLink, Profile, User, BotTypeEnum
|
||||
from .view import IssueView
|
||||
from .webhook import Webhook, WebhookLog
|
||||
from .voice_tasker import VoiceTaskSession, WorkspaceAICredential, WorkspaceAISettings
|
||||
|
||||
@@ -295,6 +295,31 @@ class Account(TimeAuditModel):
|
||||
ordering = ("-created_at",)
|
||||
|
||||
|
||||
class ExternalIdentityLink(TimeAuditModel):
|
||||
class Status(models.TextChoices):
|
||||
ACTIVE = "active", "Active"
|
||||
DISABLED = "disabled", "Disabled"
|
||||
|
||||
id = models.UUIDField(default=uuid.uuid4, unique=True, editable=False, db_index=True, primary_key=True)
|
||||
provider = models.CharField(max_length=64)
|
||||
subject = models.CharField(max_length=255)
|
||||
user = models.ForeignKey("db.User", on_delete=models.CASCADE, related_name="external_identity_links")
|
||||
email = models.CharField(max_length=255)
|
||||
groups = models.JSONField(default=list)
|
||||
status = models.CharField(max_length=32, choices=Status.choices, default=Status.ACTIVE)
|
||||
last_login_at = models.DateTimeField(blank=True, null=True)
|
||||
|
||||
class Meta:
|
||||
unique_together = [
|
||||
["provider", "subject"],
|
||||
["provider", "user"],
|
||||
]
|
||||
verbose_name = "External Identity Link"
|
||||
verbose_name_plural = "External Identity Links"
|
||||
db_table = "external_identity_links"
|
||||
ordering = ("-created_at",)
|
||||
|
||||
|
||||
@receiver(post_save, sender=User)
|
||||
def create_user_notification(sender, instance, created, **kwargs):
|
||||
# create preferences
|
||||
|
||||
Reference in New Issue
Block a user