isDriOrReadOnly.py 371 Bytes
Newer Older
1
from rest_framework import permissions
Florent Chehab's avatar
Florent Chehab committed
2
from backend_app.utils import is_member
3
4
5
6
7
8
9
10
11
12
13
14


class IsDriOrReadOnly(permissions.BasePermission):
    """
    TODO
    """

    def has_permission(self, request, view):
        if request.method in permissions.SAFE_METHODS:
            return True
        else:
            return is_member("DRI", request.user) or request.user.is_staff