constant.py 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. # -*- coding: utf-8 -*-
  2. # @Author : YY
  3. # 定义常量
  4. class HttpStatus:
  5. SUCCESS = 200
  6. CREATED = 201
  7. ACCEPTED = 202 # 已接受
  8. NO_CONTENT = 204 # 无内容
  9. MOVED_PERM = 301
  10. SEE_OTHER = 303
  11. NOT_MODIFIED = 304
  12. BAD_REQUEST = 400 # 错误的请求
  13. UNAUTHORIZED = 401 # 未授权
  14. FORBIDDEN = 403 # 禁止访问
  15. NOT_FOUND = 404 # 未找到
  16. BAD_METHOD = 405 # 方法不允许
  17. CONFLICT = 409 # 冲突
  18. UNSUPPORTED_TYPE = 415 # 请求范围不符合要求
  19. ERROR = 500 # 内部错误
  20. NOT_IMPLEMENTED = 501 # 尚未实施
  21. class Constants:
  22. CAPTCHA_EXPIRATION = 2 # 2 分钟
  23. TOKEN = "token"
  24. TOKEN_HEADER = "Authorization"
  25. LOGIN_USER_KEY = "login_user_key"
  26. TOKEN_PREFIX = "Bearer "
  27. UTF8 = "UTF-8"
  28. GBK = "GBK"
  29. HTTP = "http://"
  30. HTTPS = "https://"
  31. WWW = "www."
  32. DOT = "."
  33. SUCCESS = "0"
  34. FAIL = "1"
  35. LOGIN_SUCCESS = "Success"
  36. LOGOUT = "Logout"
  37. REGISTER = "Register"
  38. LOGIN_FAIL = "Error"
  39. CAPTCHA_CODE_KEY = "captcha_codes:"
  40. LOGIN_TOKEN_KEY = "login_tokens:"
  41. REPEAT_SUBMIT_KEY = "repeat_submit:"
  42. RATE_LIMIT_KEY = "rate_limit:"
  43. CAPTCHA_EXPIRATION = 2
  44. JWT_USERID = "userid"
  45. JWT_USERNAME = "sub"
  46. JWT_AVATAR = "avatar"
  47. JWT_CREATED = "created"
  48. JWT_AUTHORITIES = "authorities"
  49. SYS_CONFIG_KEY = "sys_config:"
  50. SYS_DICT_KEY = "sys_dict:"
  51. RESOURCE_PREFIX = "/profile"
  52. LOOKUP_RMI = "rmi:";
  53. LOOKUP_LDAP = "ldap:";
  54. LOOKUP_LDAPS = "ldaps:";
  55. JOB_WHITELIST_STR = { "com.ruoyi" };
  56. JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
  57. "org.springframework", "org.apache", "com.ruoyi.common.utils.file" }; # todo
  58. class UserConstants:
  59. # Unique identifier for system users within the platform
  60. SYS_USER = "SYS_USER"
  61. # Normal status
  62. NORMAL = "0"
  63. # Exception status
  64. EXCEPTION = "1"
  65. # User disabled status
  66. USER_DISABLE = "1"
  67. # Role disabled status
  68. ROLE_DISABLE = "1"
  69. # Department normal status
  70. DEPT_NORMAL = "0"
  71. # Department disabled status
  72. DEPT_DISABLE = "1"
  73. # Dictionary normal status
  74. DICT_NORMAL = "0"
  75. # Is it a system default (yes)
  76. YES = "Y"
  77. # Is it an external link menu (yes)
  78. YES_FRAME = "0"
  79. # Is it an external link menu (no)
  80. NO_FRAME = "1"
  81. # Menu type (directory)
  82. TYPE_DIR = "M"
  83. # Menu type (menu)
  84. TYPE_MENU = "C"
  85. # Menu type (button)
  86. TYPE_BUTTON = "F"
  87. # Layout component identifier
  88. LAYOUT = "Layout"
  89. # ParentView component identifier
  90. PARENT_VIEW = "ParentView"
  91. # InnerLink component identifier
  92. INNER_LINK = "InnerLink"
  93. # Validation return result codes
  94. UNIQUE = "0"
  95. NOT_UNIQUE = "1"
  96. # Username length restrictions
  97. USERNAME_MIN_LENGTH = 2
  98. USERNAME_MAX_LENGTH = 20
  99. # Password length restrictions
  100. PASSWORD_MIN_LENGTH = 5
  101. PASSWORD_MAX_LENGTH = 20