__does_user_have_moderation_rights.py 324 Bytes
Newer Older
Florent Chehab's avatar
Florent Chehab committed
1
from backend_app.utils import is_member
2
from base_app.models import User
3
4


Florent Chehab's avatar
Florent Chehab committed
5
def does_user_have_moderation_rights(user: User) -> bool:
6
    """
Florent Chehab's avatar
Florent Chehab committed
7
    Function to know if a user is staff or member of DRI or member of the moderator group.
8
    """
9
    return user.is_staff or is_member("DRI", user) or is_member("Moderators", user)