🐛(teams) disable creation endpoint from abilities

When we don't allow the user to see the team creation button,
we also want to disable the corresponding API.
This commit is contained in:
Quentin BEY
2025-01-30 16:45:05 +01:00
committed by BEY Quentin
parent 92753082c7
commit b4a877381a
6 changed files with 68 additions and 6 deletions

View File

@@ -573,7 +573,7 @@ class User(AbstractBaseUser, BaseModel, auth_models.PermissionsMixin):
.get()
)
teams_can_view = user_info.teams_can_view
teams_can_view = user_info.teams_can_view or settings.FEATURES["TEAMS_DISPLAY"]
mailboxes_can_view = user_info.mailboxes_can_view
return {
@@ -585,7 +585,7 @@ class User(AbstractBaseUser, BaseModel, auth_models.PermissionsMixin):
),
},
"teams": {
"can_view": teams_can_view and settings.FEATURES["TEAMS_DISPLAY"],
"can_view": teams_can_view,
"can_create": teams_can_view and settings.FEATURES["TEAMS_CREATE"],
},
"mailboxes": {