Coverage for sites/comments_site/comments_database/permissions.py: 100%

6 statements  

« prev     ^ index     » next       coverage.py v7.3.2, created at 2024-02-28 09:09 +0000

1from rest_framework.permissions import BasePermission 

2 

3from django.http import HttpRequest 

4 

5from .models import User 

6 

7 

8class MathdocSitePermission(BasePermission): 

9 def has_permission(self, request: HttpRequest, view): 

10 return ( 

11 isinstance(request.user, User) 

12 and request.user.is_authenticated 

13 and request.user.mathdoc_site is True 

14 )