Merge pull request #14684 from jumpserver/pr@dev@feat_refresh_cache_facelive

feat: refresh facelive cache
pull/14685/head
Chenyang Shen 2024-12-18 18:10:39 +08:00 committed by GitHub
commit 0e0be618e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 1 deletions

View File

@ -228,16 +228,20 @@ class FaceMonitorCallbackApi(CreateAPIView):
face_codes = serializer.validated_data.get('face_codes')
if not user:
context.save()
return Response(data={'msg': 'user {} not found'
.format(context.user_id)}, status=400)
if not self._check_face_codes(face_codes, user):
if not face_codes or not self._check_face_codes(face_codes, user):
context.save()
return Response(data={'msg': 'face codes not matched'}, status=400)
if action == FaceMonitorActionChoices.Pause:
context.pause_sessions()
if action == FaceMonitorActionChoices.Resume:
context.resume_sessions()
context.save()
return Response(status=200)
@staticmethod