src/notes/api/permissions/core.py
changeset 119 8ff8e2aee0f9
parent 117 9864fe2067cd
equal deleted inserted replaced
118:2cb8d11aa9ca 119:8ff8e2aee0f9
    33         if is_authenticated and session_ext_id:
    33         if is_authenticated and session_ext_id:
    34             return Session.objects.filter(ext_id=session_ext_id, owner=request.user).exists()
    34             return Session.objects.filter(ext_id=session_ext_id, owner=request.user).exists()
    35         else:
    35         else:
    36             return True
    36             return True
    37 
    37 
       
    38 class RootNotePermission(IsAuthenticated):
       
    39     """
       
    40     Permissions for notes
       
    41     """
       
    42 
       
    43     def has_permission(self, request, view):
       
    44         """
       
    45         Return `True` if permission is granted, `False` otherwise.
       
    46         """
       
    47         is_authenticated = super().has_permission(request, view)
       
    48         return is_authenticated
       
    49         # if not is_authenticated:
       
    50         #     return False
       
    51         # session_ext_id = view.kwargs.get('session_ext_id')
       
    52         # if is_authenticated and session_ext_id:
       
    53         #     return Session.objects.filter(ext_id=session_ext_id, owner=request.user).exists()
       
    54         # else:
       
    55         #     return True