(backend) add user abilities for front

This allows, on a per user basis, the display of
features.

The main goal here is to allow Team admin or owner
to see the management views.
We also added the same for the two other features
(mailboxes and contacts)

This will be improved later if needed :)
This commit is contained in:
Quentin BEY
2024-11-06 17:22:01 +01:00
committed by BEY Quentin
parent 4d3097e322
commit ac853299d3
7 changed files with 198 additions and 10 deletions

View File

@@ -451,18 +451,33 @@ class Base(Configuration):
)
)
FEATURES = {
"TEAMS": values.BooleanValue(
default=True, environ_name="FEATURE_TEAMS", environ_prefix=None
),
}
# pylint: disable=invalid-name
@property
def ENVIRONMENT(self):
"""Environment in which the application is launched."""
return self.__class__.__name__.lower()
# pylint: disable=invalid-name
@property
def FEATURES(self):
"""Feature flags for the application."""
FEATURE_FLAGS: set = {
"CONTACTS_CREATE", # Used in the users/me/ endpoint
"CONTACTS_DISPLAY", # Used in the users/me/ endpoint
"MAILBOXES_CREATE", # Used in the users/me/ endpoint
"TEAMS",
"TEAMS_CREATE", # Used in the users/me/ endpoint
}
return {
feature: values.BooleanValue(
default=True,
environ_name=f"FEATURE_{feature}",
environ_prefix=None,
)
for feature in FEATURE_FLAGS
}
# pylint: disable=invalid-name
@property
def RELEASE(self):