MaxKB/apps/users/views/common.py
shaohuzhang1 f9d536f5a2
Some checks are pending
sync2gitee / repo-sync (push) Waiting to run
Typos Check / Spell Check with Typos (push) Waiting to run
feat: Audit log add operation object (#2681)
2025-03-25 19:07:02 +08:00

33 lines
786 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# coding=utf-8
"""
@project: MaxKB
@Author
@file common.py
@date2025/3/25 16:46
@desc:
"""
from common.util.common import encryption
from users.models import User
from django.db.models import QuerySet
def get_user_operation_object(user_id):
user_model = QuerySet(model=User).filter(id=user_id).first()
if user_model is not None:
return {
"name": user_model.username
}
return {}
def get_re_password_details(request):
path = request.path
body = request.data
query = request.query_params
return {
'path': path,
'body': {**body, 'password': encryption(body.get('password', '')),
're_password': encryption(body.get('re_password', ''))},
'query': query
}