(dimail) automate allows requests to dimail

Automatically send user creation and allow creation requests to dimail
upon creating domain access.
This commit is contained in:
Marie PUPO JEAMMET
2024-11-20 19:14:48 +01:00
committed by Marie
parent cf155dc033
commit 54120eb179
6 changed files with 384 additions and 42 deletions

View File

@@ -51,10 +51,12 @@ class MailDomainViewSet(
"""Set the current user as owner of the newly created mail domain."""
domain = serializer.save()
models.MailDomainAccess.objects.create(
user=self.request.user,
domain=domain,
role=core_models.RoleChoices.OWNER,
serializers.MailDomainAccessSerializer().create(
validated_data={
"user": self.request.user,
"domain": domain,
"role": str(core_models.RoleChoices.OWNER),
}
)