__is_member.py 239 Bytes
Newer Older
1
from base_app.models import User
Florent Chehab's avatar
Florent Chehab committed
2 3 4


def is_member(group_name: str, user: User) -> bool:
5 6 7 8 9 10
    """
    Function to know if a user is part of a specific group.

    TODO unit test
    """
    return user.groups.filter(name=group_name).exists()