jumpserver/apps/users/permissions.py
fit2bot a5acdb9f60
perf: 统一校验当前用户api (#8324)
Co-authored-by: feng626 <1304903146@qq.com>
2022-06-07 19:26:07 +08:00

18 lines
565 B
Python

from rest_framework import permissions
from .utils import is_auth_password_time_valid, is_auth_confirm_time_valid
class IsAuthPasswdTimeValid(permissions.IsAuthenticated):
def has_permission(self, request, view):
return super().has_permission(request, view) \
and is_auth_password_time_valid(request.session)
class IsAuthConfirmTimeValid(permissions.IsAuthenticated):
def has_permission(self, request, view):
return super().has_permission(request, view) \
and is_auth_confirm_time_valid(request.session)