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


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"]