From d1b9c29f0fa4e2d4a66545b8dd456ad011964496 Mon Sep 17 00:00:00 2001 From: Liujian <824010343@qq.com> Date: Fri, 1 Nov 2024 14:19:17 +0800 Subject: [PATCH] update permit bug --- go.mod | 4 ++-- init.go | 1 + module/catalogue/iml.go | 2 ++ plugins/core/service.go | 2 +- resources/access/access.yaml | 13 ------------- scripts/prefix.sh | 7 +++++++ service/service/iml.go | 4 ++++ 7 files changed, 17 insertions(+), 16 deletions(-) diff --git a/go.mod b/go.mod index 1a433dcd..6c4ceab4 100644 --- a/go.mod +++ b/go.mod @@ -75,6 +75,6 @@ require ( gorm.io/driver/mysql v1.5.2 // indirect ) -replace github.com/eolinker/ap-account => ../../eolinker/ap-account +replace github.com/eolinker/ap-account => ../aoaccount -replace github.com/eolinker/go-common => ../../eolinker/go-common +replace github.com/eolinker/go-common => ../go-common diff --git a/init.go b/init.go index 3e398f85..74592a3a 100644 --- a/init.go +++ b/init.go @@ -7,6 +7,7 @@ import ( _ "github.com/APIParkLab/APIPark/plugins/core" _ "github.com/APIParkLab/APIPark/plugins/permit" _ "github.com/APIParkLab/APIPark/plugins/publish_flow" + _ "github.com/APIParkLab/APIPark/resources/locale" _ "github.com/eolinker/ap-account/plugin" _ "github.com/eolinker/go-common/cache/cache_redis" _ "github.com/eolinker/go-common/log-init" diff --git a/module/catalogue/iml.go b/module/catalogue/iml.go index b41a100f..4b1af781 100644 --- a/module/catalogue/iml.go +++ b/module/catalogue/iml.go @@ -320,6 +320,7 @@ func (i *imlCatalogueModule) Services(ctx context.Context, keyword string) ([]*c if err != nil { return nil, err } + serviceIds := utils.SliceToSlice(items, func(i *service.Service) string { return i.Id }, func(s *service.Service) bool { @@ -330,6 +331,7 @@ func (i *imlCatalogueModule) Services(ctx context.Context, keyword string) ([]*c if len(serviceIds) < 1 { return nil, nil } + commits, err := i.releaseService.GetRunningApiDocCommits(ctx, serviceIds...) if err != nil { return nil, err diff --git a/plugins/core/service.go b/plugins/core/service.go index eaec81bd..774ed852 100644 --- a/plugins/core/service.go +++ b/plugins/core/service.go @@ -22,7 +22,7 @@ func (p *plugin) ServiceApis() []pm3.Api { pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/simple/apps/mine", []string{"context", "query:keyword"}, []string{"apps"}, p.appController.MySimpleApps), pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/my_apps", []string{"context", "query:team", "query:keyword"}, []string{"apps"}, p.appController.SearchMyApps), pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/apps", []string{"context", "query:team", "query:keyword"}, []string{"apps"}, p.appController.Search, access.SystemWorkspaceApplicationViewAll), - pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/apps/can_subscribe", []string{"context", "query:"}, []string{"app"}, p.appController.SearchCanSubscribe), + pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/apps/can_subscribe", []string{"context", "query:service"}, []string{"app"}, p.appController.SearchCanSubscribe), pm3.CreateApiWidthDoc(http.MethodPut, "/api/v1/app/info", []string{"context", "query:app", "body"}, []string{"app"}, p.appController.UpdateApp, access.SystemWorkspaceApplicationManagerAll, access.TeamTeamConsumerManager), pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/service/doc", []string{"context", "query:service"}, []string{"doc"}, p.serviceController.ServiceDoc, access.SystemWorkspaceServiceViewAll, access.TeamServiceServiceIntroView), diff --git a/resources/access/access.yaml b/resources/access/access.yaml index 9a907fcd..69a6daee 100644 --- a/resources/access/access.yaml +++ b/resources/access/access.yaml @@ -197,13 +197,6 @@ team: value: 'manager' dependents: - team.service.subscription.view - - name: service - value: 'service' - children: - - name: manager - value: 'manager' - dependents: - - team.service.service.manager - name: consumer value: 'consumer' children: @@ -230,11 +223,6 @@ team: value: 'manager' dependents: - team.consumer.authorization.view - - name: consumer - value: 'application' - children: - - name: manager - value: 'manager' - name: team value: 'team' children: @@ -274,7 +262,6 @@ team: - name: view value: 'view' guest_allow: true - apis: - name: manager value: 'manager' apis: diff --git a/scripts/prefix.sh b/scripts/prefix.sh index 0ce4577f..d388cace 100644 --- a/scripts/prefix.sh +++ b/scripts/prefix.sh @@ -31,3 +31,10 @@ if [ ! -d "./aoaccount" ]; then fi cd "./aoaccount" && git pull +echo "更新go-common" +cd "${BASEPATH}/" +if [ ! -d "./go-common" ]; then + git clone http://gitlab.eolink.com/apinto/go-common.git +fi +cd "./go-common" && git pull + diff --git a/service/service/iml.go b/service/service/iml.go index e799e836..c3090ea0 100644 --- a/service/service/iml.go +++ b/service/service/iml.go @@ -32,6 +32,7 @@ func (i *imlServiceService) ServiceList(ctx context.Context, serviceIds ...strin w["uuid"] = serviceIds } w["as_server"] = true + w["is_delete"] = false list, err := i.store.List(ctx, w) if err != nil { return nil, err @@ -46,6 +47,7 @@ func (i *imlServiceService) ServiceListByKind(ctx context.Context, kind Kind, se } w["as_server"] = true w["kind"] = kind + w["is_delete"] = false list, err := i.store.List(ctx, w) if err != nil { return nil, err @@ -57,6 +59,7 @@ func (i *imlServiceService) SearchPublicServices(ctx context.Context, keyword st w := map[string]interface{}{ "as_server": true, "service_type": PublicService.Int(), + "is_delete": false, } list, err := i.store.Search(ctx, keyword, w) if err != nil { @@ -93,6 +96,7 @@ func (i *imlServiceService) AppList(ctx context.Context, appIds ...string) ([]*S w["uuid"] = appIds } w["as_app"] = true + w["is_delete"] = false list, err := i.store.List(ctx, w) if err != nil { return nil, err