123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- syntax = "v1"
- info(
- title: "authority control"
- desc: "authority control including authority management, role access control"
- author: "Ryan Su"
- email: "yuansu.china.work@gmail.com"
- version: "v1.0"
- )
- import "../base.api"
- type (
- // The response data of api authorization | API授权数据
- ApiAuthorityInfo {
- // API path | API 路径
- Path string `json:"path" validate="required,max=80"`
- // API method | API请求方法
- Method string `json:"method" validate="required,min=3,max=4"`
- }
- // Create or update api authorization information request | 创建或更新API授权信息
- CreateOrUpdateApiAuthorityReq {
- // Role ID | 角色ID
- RoleId uint64 `json:"roleId" validate:"required,lt=1000"`
- // API authorization list | API授权列表数据
- // Required: true
- Data []ApiAuthorityInfo `json:"data"`
- }
- // The response data of api authorization list | API授权列表返回数据
- ApiAuthorityListResp {
- BaseDataInfo
- // The api authorization list data | API授权列表数据
- Data ApiAuthorityListInfo `json:"data"`
- }
- // The data of api authorization list | API授权列表数据
- ApiAuthorityListInfo {
- BaseListInfo
- // The api authorization list data | API授权列表数据
- Data []ApiAuthorityInfo `json:"data"`
- }
- // Create or update menu authorization information request params | 创建或更新菜单授权信息参数
- MenuAuthorityInfoReq {
- // role ID | 角色ID
- RoleId uint64 `json:"roleId" validate:"required,lt=1000"`
- // menu ID array | 菜单ID数组
- MenuIds []uint64 `json:"menuIds" validate:"required"`
- }
- // Menu authorization response data | 菜单授权信息数据
- MenuAuthorityInfoResp {
- BaseDataInfo
- // The menu authorization data | 菜单授权信息数据
- Data MenuAuthorityInfoReq `json:"data"`
- }
- )
- @server(
- jwt: Auth
- group: authority
- middleware: Authority
- )
- service Core {
- // Create or update API authorization information | 创建或更新API权限
- @handler createOrUpdateApiAuthority
- post /authority/api/create_or_update (CreateOrUpdateApiAuthorityReq) returns (BaseMsgResp)
- // Get role's API authorization list | 获取角色api权限列表
- @handler getApiAuthority
- post /authority/api/role (IDReq) returns (ApiAuthorityListResp)
- // Create or update menu authorization information | 创建或更新菜单权限
- @handler createOrUpdateMenuAuthority
- post /authority/menu/create_or_update (MenuAuthorityInfoReq) returns (BaseMsgResp)
- // Get role's menu authorization list | 获取角色菜单权限列表
- @handler getMenuAuthority
- post /authority/menu/role (IDReq) returns (MenuAuthorityInfoResp)
- }
|