mirror of
https://github.com/fastapi-practices/fastapi-best-architecture.git
synced 2026-09-21 21:15:13 +00:00
Update casbin rbac verify to plugin (#513)
* Update casbin rbac verify to plugin * Update requirements * move sys api to casbin plugin * Update plugin toml and parse * Fix plugin router inject * Update api prefix to apis
This commit is contained in:
@@ -1,31 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
from datetime import datetime
|
||||
|
||||
from pydantic import ConfigDict, Field
|
||||
|
||||
from backend.common.enums import MethodType
|
||||
from backend.common.schema import SchemaBase
|
||||
|
||||
|
||||
class ApiSchemaBase(SchemaBase):
|
||||
name: str
|
||||
method: MethodType = Field(default=MethodType.GET, description='请求方法')
|
||||
path: str = Field(description='api路径')
|
||||
remark: str | None = None
|
||||
|
||||
|
||||
class CreateApiParam(ApiSchemaBase):
|
||||
pass
|
||||
|
||||
|
||||
class UpdateApiParam(ApiSchemaBase):
|
||||
pass
|
||||
|
||||
|
||||
class GetApiDetail(ApiSchemaBase):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: int
|
||||
created_time: datetime
|
||||
updated_time: datetime | None = None
|
||||
@@ -1,53 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
from pydantic import ConfigDict, Field
|
||||
|
||||
from backend.common.enums import MethodType
|
||||
from backend.common.schema import SchemaBase
|
||||
|
||||
|
||||
class CreatePolicyParam(SchemaBase):
|
||||
sub: str = Field(description='用户uuid / 角色ID')
|
||||
path: str = Field(description='api 路径')
|
||||
method: MethodType = Field(default=MethodType.GET, description='请求方法')
|
||||
|
||||
|
||||
class UpdatePolicyParam(SchemaBase):
|
||||
old: CreatePolicyParam
|
||||
new: CreatePolicyParam
|
||||
|
||||
|
||||
class UpdatePoliciesParam(SchemaBase):
|
||||
old: list[CreatePolicyParam]
|
||||
new: list[CreatePolicyParam]
|
||||
|
||||
|
||||
class DeletePolicyParam(CreatePolicyParam):
|
||||
pass
|
||||
|
||||
|
||||
class DeleteAllPoliciesParam(SchemaBase):
|
||||
uuid: str | None = None
|
||||
role: str
|
||||
|
||||
|
||||
class CreateUserRoleParam(SchemaBase):
|
||||
uuid: str = Field(description='用户 uuid')
|
||||
role: str = Field(description='角色')
|
||||
|
||||
|
||||
class DeleteUserRoleParam(CreateUserRoleParam):
|
||||
pass
|
||||
|
||||
|
||||
class GetPolicyDetail(SchemaBase):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: int
|
||||
ptype: str = Field(description='规则类型, p / g')
|
||||
v0: str = Field(description='用户 uuid / 角色')
|
||||
v1: str = Field(description='api 路径 / 角色')
|
||||
v2: str | None = None
|
||||
v3: str | None = None
|
||||
v4: str | None = None
|
||||
v5: str | None = None
|
||||
Reference in New Issue
Block a user