MaxKB/apps/common/constants/cache_version.py
shaohuzhang1 dcb77bbe16
Some checks are pending
sync2gitee / repo-sync (push) Waiting to run
feat: Captcha (#2913)
2025-04-17 19:16:54 +08:00

34 lines
809 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 cache_version.py
@date2025/4/14 19:09
@desc:
"""
from enum import Enum
class Cache_Version(Enum):
# 令牌
TOKEN = "TOKEN", lambda token: token
# 工作空间列表
WORKSPACE_LIST = "WORKSPACE:LIST", lambda user_id: user_id
# 用户数据
USER = "USER", lambda user_id: user_id
# 当前用户所有的角色
ROLE_LIST = "ROLE:LIST", lambda user_id: user_id
# 当前用户所有权限
PERMISSION_LIST = "PERMISSION:LIST", lambda user_id: user_id
CAPTCHA = "CAPTCHA", lambda captcha: captcha
def get_version(self):
return self.value[0]
def get_key_func(self):
return self.value[1]
def get_key(self, **kwargs):
return self.value[1](**kwargs)