refactor: 权限组简化为2组(readonly/write) + Transfer穿梭框选择数据库
- access_type 从3值(readonly/datachange/ddl)简化为2值(readonly/write) - readonly=只读查看(关联只读/从库用于查询) write=写入变更(关联主库用于工单) - 前端InstanceGroupPage重写: 2权限类型卡片+自定义Transfer穿梭框组件 - Transfer组件: 左侧可选数据库→右侧已授权数据库, 搜索/勾选/箭头移动 - role_permissions.py更新: 2值权限映射, get_accessible_instances按access_type过滤 - 后端schema/模型校验更新为readonly|write正则 - 15个测试全部通过
This commit is contained in:
1 parent
8161bcf5b5
commit
4111e1eee8
6 files changed
+352
-316
No files matched your search
@@ -26,7 +26,7 @@ class InstanceGroup(Base):
|
||||
description = Column(Text, nullable=True)
|
||||
db_type = Column(String(20), nullable=False, default="all") # mysql/redis/pg/mongo/all
|
||||
permissions = Column(Text, nullable=True) # JSON: ["query:select", ...] (legacy, kept for compat)
|
||||
access_type = Column(String(20), nullable=True, default="readonly") # readonly / datachange / ddl
|
||||
access_type = Column(String(20), nullable=True, default="readonly") # readonly / write
|
||||
allowed_databases = Column(Text, nullable=True) # JSON array of database names; empty = all databases
|
||||
is_active = Column(Boolean, default=True)
|
||||
created_at = Column(DateTime, server_default=func.now())
|
||||
@@ -65,4 +65,4 @@ class InstanceGroup(Base):
|
||||
json.dumps(databases, ensure_ascii=False) if databases else None
|
||||
)
|
||||
|
||||
VALID_ACCESS_TYPES = {"readonly", "datachange", "ddl"}
|
||||
VALID_ACCESS_TYPES = {"readonly", "write"}
|
||||
Reference in new issue
Block a user