🔒️(organization) the first user is not admin

The first user of a organization is probably not an admin.
This was implemented for first tests but for now it's more
a security issue than something helpful.

FIXES #775
This commit is contained in:
Quentin BEY
2025-03-07 17:55:42 +01:00
parent b8beb56135
commit a65e61bd96
3 changed files with 3 additions and 11 deletions

View File

@@ -8,6 +8,7 @@ and this project adheres to
## [Unreleased] ## [Unreleased]
- 🔒️(organization) the first user is not admin #776
- 🐛(admin) fix broken alias import #1021 - 🐛(admin) fix broken alias import #1021
## [1.22.0] - 2026-01-19 ## [1.22.0] - 2026-01-19

View File

@@ -17,8 +17,6 @@ from core.models import (
AccountService, AccountService,
Contact, Contact,
Organization, Organization,
OrganizationAccess,
OrganizationRoleChoices,
) )
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@@ -131,15 +129,6 @@ class OIDCAuthenticationBackend(LaSuiteOIDCAuthenticationBackend):
user = super().create_user(claims | {"organization": organization}) user = super().create_user(claims | {"organization": organization})
if organization_created:
# Warning: we may remove this behavior in the near future when we
# add a feature to claim the organization ownership.
OrganizationAccess.objects.create(
organization=organization,
user=user,
role=OrganizationRoleChoices.ADMIN,
)
# Initiate the user's profile # Initiate the user's profile
Contact.objects.create( Contact.objects.create(
owner=user, owner=user,

View File

@@ -391,6 +391,8 @@ def test_authentication_getter_new_user_with_registration_id_new_organization(
assert user.organization.domain_list == expected_domain_list assert user.organization.domain_list == expected_domain_list
assert user.organization.registration_id_list == expected_registration_id_list assert user.organization.registration_id_list == expected_registration_id_list
assert models.OrganizationAccess.objects.filter(user=user).exists() is False
def test_authentication_getter_existing_user_via_email_update_organization( def test_authentication_getter_existing_user_via_email_update_organization(
django_assert_num_queries, monkeypatch django_assert_num_queries, monkeypatch