后台权限组详情/授权菜单接口等等
This commit is contained in:
@@ -11,22 +11,22 @@ import (
|
||||
"fusenapi/server/ldap-admin/internal/types"
|
||||
)
|
||||
|
||||
func SetLdapGroupMenusHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
func GetLdapGroupDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
var req types.SetLdapGroupMenusReq
|
||||
var req types.GetLdapGroupDetailReq
|
||||
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// 创建一个业务逻辑层实例
|
||||
l := logic.NewSetLdapGroupMenusLogic(r.Context(), svcCtx)
|
||||
l := logic.NewGetLdapGroupDetailLogic(r.Context(), svcCtx)
|
||||
|
||||
rl := reflect.ValueOf(l)
|
||||
basic.BeforeLogic(w, r, rl)
|
||||
|
||||
resp := l.SetLdapGroupMenus(&req, userinfo)
|
||||
resp := l.GetLdapGroupDetail(&req, userinfo)
|
||||
|
||||
if !basic.AfterLogic(w, r, rl, resp) {
|
||||
basic.NormalAfterLogic(w, r, resp)
|
||||
@@ -17,6 +17,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||
Path: "/api/ldap-admin/get_ldap_group",
|
||||
Handler: GetLdapGroupsHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/api/ldap-admin/get_ldap_group_detail",
|
||||
Handler: GetLdapGroupDetailHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/api/ldap-admin/save_ldap_group",
|
||||
@@ -29,13 +34,8 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/api/ldap-admin/set_ldap_group_menus",
|
||||
Handler: SetLdapGroupMenusHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/api/ldap-admin/set_ldap_casbin_rule",
|
||||
Handler: SetLdapCasbinRuleHandler(serverCtx),
|
||||
Path: "/api/ldap-admin/set_ldap_group_auth",
|
||||
Handler: SetLdapGroupAuthHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
|
||||
@@ -11,22 +11,22 @@ import (
|
||||
"fusenapi/server/ldap-admin/internal/types"
|
||||
)
|
||||
|
||||
func SetLdapCasbinRuleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
func SetLdapGroupAuthHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
var req types.SetLdapCasbinRuleReq
|
||||
var req types.SetLdapGroupAuthReq
|
||||
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// 创建一个业务逻辑层实例
|
||||
l := logic.NewSetLdapCasbinRuleLogic(r.Context(), svcCtx)
|
||||
l := logic.NewSetLdapGroupAuthLogic(r.Context(), svcCtx)
|
||||
|
||||
rl := reflect.ValueOf(l)
|
||||
basic.BeforeLogic(w, r, rl)
|
||||
|
||||
resp := l.SetLdapCasbinRule(&req, userinfo)
|
||||
resp := l.SetLdapGroupAuth(&req, userinfo)
|
||||
|
||||
if !basic.AfterLogic(w, r, rl, resp) {
|
||||
basic.NormalAfterLogic(w, r, resp)
|
||||
Reference in New Issue
Block a user