__get_user_level.py 481 Bytes
Newer Older
1
from .__is_member import is_member
Florent Chehab's avatar
Florent Chehab committed
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from backend.permissions import OBJ_MODERATION_PERMISSIONS


def get_user_level(user):
    """
    TODO unit test
    """
    if user.is_staff:
        return OBJ_MODERATION_PERMISSIONS["staff"]
    elif is_member('DRI', user):
        return OBJ_MODERATION_PERMISSIONS["DRI"]
    elif is_member('Moderators', user):
        return OBJ_MODERATION_PERMISSIONS["moderator"]
    else:
        return OBJ_MODERATION_PERMISSIONS["authenticated_user"]