正在显示
4 个修改的文件
包含
54 行增加
和
0 行删除
@@ -30,6 +30,9 @@ service Core { | @@ -30,6 +30,9 @@ service Core { | ||
30 | @doc "角色列表搜索" | 30 | @doc "角色列表搜索" |
31 | @handler systemSearchRole | 31 | @handler systemSearchRole |
32 | post /system/role/search (RoleSearchRequest) returns (RoleSearchResponse) | 32 | post /system/role/search (RoleSearchRequest) returns (RoleSearchResponse) |
33 | + @doc "角色权限列表" | ||
34 | + @handler systemGetRoleAuths | ||
35 | + get /system/role/auths | ||
33 | } | 36 | } |
34 | 37 | ||
35 | type ( | 38 | type ( |
1 | +package role | ||
2 | + | ||
3 | +import ( | ||
4 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result" | ||
5 | + "net/http" | ||
6 | + | ||
7 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/role" | ||
8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | ||
9 | +) | ||
10 | + | ||
11 | +func SystemGetRoleAuthsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
12 | + return func(w http.ResponseWriter, r *http.Request) { | ||
13 | + l := role.NewSystemGetRoleAuthsLogic(r.Context(), svcCtx) | ||
14 | + resp, err := l.SystemGetRoleAuths() | ||
15 | + result.HttpResult(r, w, resp, err) | ||
16 | + } | ||
17 | +} |
@@ -593,6 +593,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | @@ -593,6 +593,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | ||
593 | Path: "/system/role/search", | 593 | Path: "/system/role/search", |
594 | Handler: role.SystemSearchRoleHandler(serverCtx), | 594 | Handler: role.SystemSearchRoleHandler(serverCtx), |
595 | }, | 595 | }, |
596 | + { | ||
597 | + Method: http.MethodGet, | ||
598 | + Path: "/system/role/auths", | ||
599 | + Handler: role.SystemGetRoleAuthsHandler(serverCtx), | ||
600 | + }, | ||
596 | }..., | 601 | }..., |
597 | ), | 602 | ), |
598 | rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret), | 603 | rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret), |
1 | +package role | ||
2 | + | ||
3 | +import ( | ||
4 | + "context" | ||
5 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | ||
6 | + | ||
7 | + "github.com/zeromicro/go-zero/core/logx" | ||
8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | ||
9 | +) | ||
10 | + | ||
11 | +type SystemGetRoleAuthsLogic struct { | ||
12 | + logx.Logger | ||
13 | + ctx context.Context | ||
14 | + svcCtx *svc.ServiceContext | ||
15 | +} | ||
16 | + | ||
17 | +func NewSystemGetRoleAuthsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemGetRoleAuthsLogic { | ||
18 | + return &SystemGetRoleAuthsLogic{ | ||
19 | + Logger: logx.WithContext(ctx), | ||
20 | + ctx: ctx, | ||
21 | + svcCtx: svcCtx, | ||
22 | + } | ||
23 | +} | ||
24 | + | ||
25 | +func (l *SystemGetRoleAuthsLogic) SystemGetRoleAuths() (interface{}, error) { | ||
26 | + return map[string]interface{}{ | ||
27 | + "list": domain.Auths, | ||
28 | + }, nil | ||
29 | +} |
-
请 注册 或 登录 后发表评论