usermod/Model/AuthRuleModel.py

45 lines
1.8 KiB
Python
Raw Normal View History

2023-02-08 17:03:25 +08:00
import uuid
from sqlalchemy import Column, String, Boolean, ForeignKey, Enum, Text, DateTime, func, Integer
from Utils.SqlAlchemyUtils import Base
2023-02-13 14:42:35 +08:00
# class AuthRuleNode(Base):
# __tablename__ = "AUTH_RULE_NODE_TABLE"
# id = Column(Integer, primary_key=True, comment="规则节点id")
# name = Column(String(32), unique=True, comment="规则节点名称")
# node_type = Column(Enum("category", "rule", name="节点类型"))
# belong = Column(Integer, comment="所属节点")
#
# def to_dict(self):
# return {c.name: getattr(self, c.name) for c in self.__table__.columns}
#
#
2023-02-09 16:10:25 +08:00
class DefaultAuthRuleConfig(Base):
__tablename__ = "default_auth_rule_config_table"
id = Column(Integer, primary_key=True, comment="默认权限规则配置id")
2023-02-10 09:15:17 +08:00
name = Column(String(32), unique=True, comment="默认权限规则配置名称")
auth_data = Column(Text, comment="权限数据")
def to_dict(self):
return {c.name: getattr(self, c.name) for c in self.__table__.columns}
2023-02-13 14:42:35 +08:00
class AuthRule(Base):
__tablename__ = "AUTH_RULE_TABLE"
id = Column(Integer, primary_key=True, comment="权限规则id")
name = Column(String(32), unique=True, comment="权限规则名称")
category1 = Column(String(64), comment="一级分类")
category2 = Column(String(64), comment="二级分类")
def to_dict(self):
return {c.name: getattr(self, c.name) for c in self.__table__.columns}
class AuthCategory(Base):
__tablename__ = "AUTH_CATEGORY_TABLE"
id = Column(Integer, primary_key=True, comment="权限分类id")
name = Column(String(32), unique=True, comment="权限分类名称")
category_level = Column(Integer, comment="权限分类级别") # 1为一级分类 2为二级分类
belong = Column(Integer, comment="所属级别")