Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:add patch point. #1692

Merged
merged 1 commit into from
Aug 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions dongtai_common/permissions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

from rest_framework import permissions

from dongtai_conf.patch import patch_point


class ScopedPermission(permissions.BasePermission):
"""
Expand Down Expand Up @@ -44,6 +46,14 @@ class UserPermission(ScopedPermission):

def has_permission(self, request, view):
user = request.user
from dongtai_common.endpoint import OpenApiEndPoint

if user is not None and user.is_active and issubclass(view.__class__, OpenApiEndPoint):
return True
extend_permission = None
_, _, extend_permission = patch_point(request, view, extend_permission)
if extend_permission is not None:
return extend_permission
if user is not None and user.is_active:
return True
return False
Expand Down
Loading