feat: implement LMS core (CMS, Courses, Enrollment, Progress, Auth) (Admin + API)
Build & Push Docker Image (Backend) / build (push) Successful in 54s
Build & Push Docker Image (Backend) / build (push) Successful in 54s
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
from rest_framework.permissions import BasePermission, SAFE_METHODS
|
||||
|
||||
class IsStaffOrReadOnly(BasePermission):
|
||||
"""
|
||||
- อ่านได้ทุกคน
|
||||
- เขียนได้เฉพาะ staff
|
||||
"""
|
||||
|
||||
def has_permission(self, request, view):
|
||||
if request.method in SAFE_METHODS:
|
||||
return True
|
||||
return request.user and request.user.is_staff
|
||||
Reference in New Issue
Block a user