diff --git a/.gitignore b/.gitignore
index 17943495..830ed6b3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,4 @@
/config.yml
/build/
/apipark
+.gitlab-ci.yml
\ No newline at end of file
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
deleted file mode 100644
index df0d9946..00000000
--- a/.gitlab-ci.yml
+++ /dev/null
@@ -1,98 +0,0 @@
-variables:
- PATH: /opt/go-1.21/go/bin/:/opt/node/node/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
- GOROOT: /opt/go-1.21/go
- GOPROXY: https://goproxy.cn
- VERSION: $CI_COMMIT_SHORT_SHA
- APP: apipark
- APP_PRE: ${APP}_${VERSION}
- BUILD_DIR: ${APP}-build
- DEPLOY_DESC: "DEV 环境"
- VIEW_ADDR: http://172.18.166.219:8288
- SAVE_DIR: /opt/${APP}
- NODE_OPTIONS: --max_old_space_size=8192
-
-stages:
- - notice
- - prefix
- - build
- - deploy
- - webhook
-
-feishu-informer: # 飞书回调
- stage: notice
- variables:
- DIFF_URL: "$CI_MERGE_REQUEST_PROJECT_URL/-/merge_requests/$CI_MERGE_REQUEST_IID/diffs"
- rules:
- - if: $CI_PIPELINE_SOURCE=="merge_request_event" && $CI_COMMIT_BRANCH =~ "main"
- script:
- - echo "merge request"
- - |
- curl -X POST -H "Content-Type: application/json" \
- -d "{\"msg_type\":\"text\",\"content\":{\"text\":\"项目:${CI_PROJECT_NAME}\\n提交人:${GITLAB_USER_NAME}\\n提交信息:${CI_MERGE_REQUEST_TITLE}\\n合并分支信息:${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME} -> ${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}\\n差异性地址:${DIFF_URL}\\n请及时review代码\"}}" \
- https://open.feishu.cn/open-apis/bot/v2/hook/1c334752-2874-41a1-8f1b-3060f2d46b6c
-
-prebuild:
- stage: prefix
- rules:
- - if: $CI_COMMIT_BRANCH == "main"
- script:
- - echo "prebuild"
- - chmod +x ./scripts/prefix.sh
- - ./scripts/prefix.sh
-
-builder:
- stage: build
- rules:
- - if: $CI_COMMIT_BRANCH == "main"
- script:
- - set -e
- - |
- if [ ! -d "../artifacts" ]; then
- mkdir -p ../artifacts
- fi
- if [ -d "../artifacts/dist" ]; then
- cp -r ../artifacts/dist frontend/dist
- fi
- - |
- if [ -n "$(git diff --name-status HEAD~1 HEAD -- frontend)" ]; then
- ./scripts/build.sh $BUILD_DIR ${VERSION} all ""
- else
- ./scripts/build.sh $BUILD_DIR ${VERSION}
- fi
- if [ -d "frontend/dist" ]; then
- echo "copy frontend/dist to artifacts/dist"
- rm -fr ../artifacts/dist
- cp -r frontend/dist ../artifacts/dist
- fi
- cp $BUILD_DIR/${APP_PRE}_linux_amd64.tar.gz ${SAVE_DIR}
-
-deployer:
- stage: deploy
- rules:
- - if: $CI_COMMIT_BRANCH == "main"
- variables:
- APIPARK_GUEST_MODE: allow
- APIPARK_GUEST_ID: dklejrfbhjqwdh
- script:
- - cd ${SAVE_DIR};mkdir -p ${APP_PRE};tar -zxvf ${APP_PRE}_linux_amd64.tar.gz -C ${APP_PRE};cd ${APP_PRE};./install.sh ${SAVE_DIR};./run.sh restart;cd ${SAVE_DIR} && ./clean.sh ${APP_PRE}
- when: on_success
-success:
- stage: webhook
- rules:
- - if: $CI_COMMIT_BRANCH == "main"
- script:
- - |
- curl -X POST -H "Content-Type: application/json" \
- -d "{\"msg_type\":\"text\",\"content\":{\"text\":\"最近一次提交:${CI_COMMIT_TITLE}\\n提交人:${GITLAB_USER_NAME}\\n项目:${CI_PROJECT_NAME}\\n环境:${DEPLOY_DESC}\\n更新部署完成.\\n访问地址:${VIEW_ADDR}\\n工作流地址:${CI_PIPELINE_URL}\"}}" \
- https://open.feishu.cn/open-apis/bot/v2/hook/c3672932-4dfa-4989-8023-0128bae59338
- when: on_success
-failure:
- stage: webhook
- rules:
- - if: $CI_COMMIT_BRANCH == "main"
- script:
- - |
- curl -X POST -H "Content-Type: application/json" \
- -d "{\"msg_type\":\"text\",\"content\":{\"text\":\"最近一次提交:${CI_COMMIT_TITLE}\\n提交人:${GITLAB_USER_NAME}\\n项目:${CI_PROJECT_NAME}\\n环境:${DEPLOY_DESC}\\n更新部署失败,请及时到gitlab上查看\\n工作流地址:${CI_PIPELINE_URL}\"}}" \
- https://open.feishu.cn/open-apis/bot/v2/hook/c3672932-4dfa-4989-8023-0128bae59338
- when: on_failure
diff --git a/README.md b/README.md
index f4801f89..6c52c63a 100644
--- a/README.md
+++ b/README.md
@@ -197,7 +197,7 @@ To achieve this goal, we plan to add new features to APIPark, including:
# 📕 Documentation
-Visit [APIPark Documentation](https://docs.apipark.com/docs/install) for detailed installation guides, API references, and usage instructions.
+Visit [APIPark Documentation](https://docs.apipark.com/docs/deploy) for detailed installation guides, API references, and usage instructions.
diff --git a/controller/service/iml.go b/controller/service/iml.go
index b8cfdc8a..0c6bcbb9 100644
--- a/controller/service/iml.go
+++ b/controller/service/iml.go
@@ -5,6 +5,9 @@ import (
"fmt"
"net/http"
"strings"
+ "time"
+
+ "github.com/eolinker/eosc/log"
application_authorization "github.com/APIParkLab/APIPark/module/application-authorization"
application_authorization_dto "github.com/APIParkLab/APIPark/module/application-authorization/dto"
@@ -212,10 +215,7 @@ func (i *imlServiceController) createAIService(ctx *gin.Context, teamID string,
if err != nil {
return err
}
- //_, err = i.upstreamModule.Save(ctx, info.Id, newAIUpstream(info.Id, *input.Provider, p.URI()))
- //if err != nil {
- // return err
- //}
+
return i.docModule.SaveServiceDoc(ctx, info.Id, &service_dto.SaveServiceDoc{
Doc: "The Translation API allows developers to translate text from one language to another. It supports multiple languages and enables easy integration of high-quality translation features into applications. With simple API requests, you can quickly translate content into different target languages.",
})
@@ -237,7 +237,12 @@ func (i *imlServiceController) SearchMyServices(ctx *gin.Context, teamId string,
//}
func (i *imlServiceController) Get(ctx *gin.Context, id string) (*service_dto.Service, error) {
+ now := time.Now()
+ defer func() {
+ log.Infof("get service %s cost %d ms", id, time.Since(now).Milliseconds())
+ }()
return i.module.Get(ctx, id)
+
}
func (i *imlServiceController) Search(ctx *gin.Context, teamID string, keyword string) ([]*service_dto.ServiceItem, error) {
@@ -279,6 +284,10 @@ type imlAppController struct {
authModule application_authorization.IAuthorizationModule `autowired:""`
}
+func (i *imlAppController) SearchCanSubscribe(ctx *gin.Context, serviceId string) ([]*service_dto.SimpleAppItem, error) {
+ return i.module.SearchCanSubscribe(ctx, serviceId)
+}
+
func (i *imlAppController) Search(ctx *gin.Context, teamId string, keyword string) ([]*service_dto.AppItem, error) {
return i.module.Search(ctx, teamId, keyword)
}
diff --git a/controller/service/service.go b/controller/service/service.go
index 3f19cd66..e64354e3 100644
--- a/controller/service/service.go
+++ b/controller/service/service.go
@@ -42,6 +42,7 @@ type IAppController interface {
// SimpleApps 获取简易项目列表
SimpleApps(ctx *gin.Context, keyword string) ([]*service_dto.SimpleAppItem, error)
MySimpleApps(ctx *gin.Context, keyword string) ([]*service_dto.SimpleAppItem, error)
+ SearchCanSubscribe(ctx *gin.Context, keyword string) ([]*service_dto.SimpleAppItem, error)
GetApp(ctx *gin.Context, appId string) (*service_dto.App, error)
DeleteApp(ctx *gin.Context, appId string) error
}
diff --git a/frontend/packages/common/src/components/aoplatform/MemberTransfer.tsx b/frontend/packages/common/src/components/aoplatform/MemberTransfer.tsx
index d7972d94..ac3b513d 100644
--- a/frontend/packages/common/src/components/aoplatform/MemberTransfer.tsx
+++ b/frontend/packages/common/src/components/aoplatform/MemberTransfer.tsx
@@ -1,5 +1,5 @@
-import { TransferProps, TreeDataNode, Tree, Spin, Input } from "antd";
+import { TransferProps, TreeDataNode, Tree, Spin, Input, Empty } from "antd";
import { DataNode } from "antd/es/tree";
import { Ref, forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
import { ApartmentOutlined, LoadingOutlined, UserOutlined } from "@ant-design/icons";
@@ -149,10 +149,9 @@ const generateTree = (
return (
} spinning={loading} className=''>
- setSearchWord(e.target.value)} value={searchWord} />
- setSearchWord(e.target.value)} value={searchWord} />
+ <>{ translatedDataSource && translatedDataSource.length > 0 ?
-
+ : }>
);
diff --git a/frontend/packages/common/src/components/aoplatform/WithPermission.tsx b/frontend/packages/common/src/components/aoplatform/WithPermission.tsx
index e092d411..2b1a37d7 100644
--- a/frontend/packages/common/src/components/aoplatform/WithPermission.tsx
+++ b/frontend/packages/common/src/components/aoplatform/WithPermission.tsx
@@ -39,7 +39,7 @@ const WithPermission = ({access, tooltip, children,disabled, showDisabled = true
{ cloneElement(children, {disabled:true})}
}
{!editAccess && (children?.type !== Button && children?.type !== Upload && showDisabled) &&
- { cloneElement(children, {disabled:true,okButtonProps:{disabled:true}})}
+ { cloneElement(children, {disabled:true, onClick:(e)=>e.preventDefault(),okButtonProps:{disabled:true}})}
}
>
diff --git a/frontend/packages/core/src/App.css b/frontend/packages/core/src/App.css
index 9afb2c31..dbc2b579 100644
--- a/frontend/packages/core/src/App.css
+++ b/frontend/packages/core/src/App.css
@@ -294,4 +294,9 @@ a{
.ant-select-selection-overflow-item:first-child {
max-width: calc(100% - 60px);
margin-right: 4px;
- }
\ No newline at end of file
+ }
+
+ a[disabled]:hover {
+ color: #BBB;
+ cursor: not-allowed;
+ }
\ No newline at end of file
diff --git a/frontend/packages/core/src/pages/aiService/AiServiceInsidePage.tsx b/frontend/packages/core/src/pages/aiService/AiServiceInsidePage.tsx
index 485e3684..e0eaad83 100644
--- a/frontend/packages/core/src/pages/aiService/AiServiceInsidePage.tsx
+++ b/frontend/packages/core/src/pages/aiService/AiServiceInsidePage.tsx
@@ -42,6 +42,7 @@ const AiServiceInsidePage:FC = ()=> {
const getApiDefine = ()=>{
+ console.log('@@@@@@@')
setApiPrefix('')
setPrefixForce(false)
fetchData>('service/router/define',{method:'GET',eoParams:{service:serviceId,team:teamId}}).then(response=>{
@@ -119,7 +120,7 @@ const AiServiceInsidePage:FC = ()=> {
}, [currentUrl]);
useEffect(()=>{
- if(accessData && accessData.get('team') && accessData.get('team')?.indexOf('team.service.router.view') !== -1){
+ if(accessData && checkPermission('team.service.router.view')){
getApiDefine()
}
},[accessData])
diff --git a/frontend/packages/core/src/pages/logsettings/LogSettingsInstruction.tsx b/frontend/packages/core/src/pages/logsettings/LogSettingsInstruction.tsx
index b7f2d7e1..e545d1d0 100644
--- a/frontend/packages/core/src/pages/logsettings/LogSettingsInstruction.tsx
+++ b/frontend/packages/core/src/pages/logsettings/LogSettingsInstruction.tsx
@@ -1,4 +1,5 @@
+import WithPermission from "@common/components/aoplatform/WithPermission";
import { useBreadcrumb } from "@common/contexts/BreadcrumbContext";
import { $t } from "@common/locales";
import { useEffect } from "react";
@@ -24,7 +25,7 @@ export default function LogSettingsInstruction() {
环境配置
新增集群的地址、名称、描述和其他相关属性,以确保插件能够正确识别和连接到集群
-
添加集群地址
+
添加集群地址
diff --git a/frontend/packages/core/src/pages/resourcesettings/ResourceSettingsInstruction.tsx b/frontend/packages/core/src/pages/resourcesettings/ResourceSettingsInstruction.tsx
index b1cd0af1..6afff314 100644
--- a/frontend/packages/core/src/pages/resourcesettings/ResourceSettingsInstruction.tsx
+++ b/frontend/packages/core/src/pages/resourcesettings/ResourceSettingsInstruction.tsx
@@ -1,3 +1,4 @@
+import WithPermission from "@common/components/aoplatform/WithPermission";
import { useBreadcrumb } from "@common/contexts/BreadcrumbContext";
import { useEffect } from "react";
import { Link } from "react-router-dom";
@@ -24,7 +25,7 @@ export default function ResourceSettingsInstruction() {
集群配置
新增集群地址、描述和其他相关属性,以确保插件能够正确识别和连接到集群
-
配置集群地址
+
配置集群地址
diff --git a/frontend/packages/core/src/pages/system/SystemInsidePage.tsx b/frontend/packages/core/src/pages/system/SystemInsidePage.tsx
index c17958c2..e842e273 100644
--- a/frontend/packages/core/src/pages/system/SystemInsidePage.tsx
+++ b/frontend/packages/core/src/pages/system/SystemInsidePage.tsx
@@ -117,7 +117,7 @@ const SystemInsidePage:FC = ()=> {
}, [currentUrl]);
useEffect(()=>{
- if(accessData && accessData.get('team') && accessData.get('team')?.indexOf('team.service.router.view') !== -1){
+ if(accessData && checkPermission('team.service.router.view')){
getApiDefine()
}
},[accessData])
diff --git a/frontend/packages/core/src/pages/team/TeamInsideMember.tsx b/frontend/packages/core/src/pages/team/TeamInsideMember.tsx
index dedf4f37..97408e9d 100644
--- a/frontend/packages/core/src/pages/team/TeamInsideMember.tsx
+++ b/frontend/packages/core/src/pages/team/TeamInsideMember.tsx
@@ -20,7 +20,7 @@ import WithPermission from "@common/components/aoplatform/WithPermission.tsx";
import { $t } from "@common/locales/index.ts";
export const getDepartmentWithMember = (department:(DepartmentListItem & {type?:'department'|'member'})[],departmentMap:Map) : (DepartmentWithMemberItem | undefined)[] =>{
- return department.map((x:DepartmentListItem & {type?:'department'|'member'})=>{
+ return department?.map((x:DepartmentListItem & {type?:'department'|'member'})=>{
const res = ({
...x,
key:x.id,
@@ -28,7 +28,7 @@ export const getDepartmentWithMember = (department:(DepartmentListItem & {type?:
type: x.type || 'department',
children:((x.type === 'member' || (!x.children||x.children.length === 0 )&& (!departmentMap.get(x.id) || departmentMap.get(x.id)!.length === 0))? undefined : [...(x.children && x.children.length > 0 ? getDepartmentWithMember(x.children,departmentMap) : []),...departmentMap.get(x.id) || []])
});
- return res}).filter(node=>node.type === 'member' ||( node.children && node.children.length > 0))
+ return res})?.filter(node=>node.type === 'member' ||( node.children && node.children.length > 0)) || []
}
export const addMemberToDepartment = (departmentMap: Map, departmentId: string, member: MemberItem) => {
@@ -84,6 +84,7 @@ const TeamInsideMember:FC = ()=>{
addMemberToDepartment(departmentMap, '_withoutDepartment', member);
}
});
+
const finalData = departmentResponse.data.department
? [
@@ -93,7 +94,7 @@ const TeamInsideMember:FC = ()=>{
name: departmentResponse.data.department.name,
title:departmentResponse.data.department.name,
children: [
- ...getDepartmentWithMember(departmentResponse.data.department.children, departmentMap),
+ ...getDepartmentWithMember(departmentResponse.data.department?.children || [], departmentMap),
...departmentMap.get('_withoutDepartment') || []
]
}
@@ -116,7 +117,6 @@ const TeamInsideMember:FC = ()=>{
setAllMemberSelectedDepartIds((pre)=>[...pre, topDepartmentId])
}
-
return {data:finalData, success: true}
}).catch(()=>({data:[], success:false}))
}
@@ -218,7 +218,6 @@ const TeamInsideMember:FC = ()=>{
const changeMemberInfo = (value:string[],entity:TeamMemberTableListItem )=>{
- //console.log(value)
return new Promise((resolve, reject) => {
fetchData>(`team/member/role`, {method: 'PUT',eoBody:({roles:value, users:[entity.user.id]}), eoParams: {team:teamId}}).then(response => {
const {code, msg} = response
diff --git a/frontend/packages/dashboard/src/pages/DashboardInstruction.tsx b/frontend/packages/dashboard/src/pages/DashboardInstruction.tsx
index f2a7c727..f3f577db 100644
--- a/frontend/packages/dashboard/src/pages/DashboardInstruction.tsx
+++ b/frontend/packages/dashboard/src/pages/DashboardInstruction.tsx
@@ -1,4 +1,5 @@
+import WithPermission from "@common/components/aoplatform/WithPermission";
import { $t } from "@common/locales";
import { Link } from "react-router-dom";
@@ -15,13 +16,13 @@ export default function DashboardInstruction({showClusterIns, showMonitorIns}:{s
{showClusterIns && }
{showMonitorIns &&
}
diff --git a/frontend/packages/market/src/pages/serviceHub/ServiceHubDetail.tsx b/frontend/packages/market/src/pages/serviceHub/ServiceHubDetail.tsx
index 4284e0cd..d6d10f00 100644
--- a/frontend/packages/market/src/pages/serviceHub/ServiceHubDetail.tsx
+++ b/frontend/packages/market/src/pages/serviceHub/ServiceHubDetail.tsx
@@ -89,10 +89,10 @@ const ServiceHubDetail = ()=>{
const getMySelectList = ()=>{
setMySystemOptionList([])
- fetchData>('simple/apps/mine',{method:'GET'}).then(response=>{
+ fetchData>('apps/can_subscribe',{method:'GET'}).then(response=>{
const {code,data,msg} = response
if(code === STATUS_CODE.SUCCESS){
- setMySystemOptionList(data.apps?.map((x:SimpleSystemItem)=>{return {
+ setMySystemOptionList(data.app?.map((x:EntityItem)=>{return {
label:x.name, value:x.id
}}))
}else{
diff --git a/frontend/packages/market/src/pages/serviceHub/management/ManagementConfig.tsx b/frontend/packages/market/src/pages/serviceHub/management/ManagementConfig.tsx
index f57194fa..c0f7f6da 100644
--- a/frontend/packages/market/src/pages/serviceHub/management/ManagementConfig.tsx
+++ b/frontend/packages/market/src/pages/serviceHub/management/ManagementConfig.tsx
@@ -8,6 +8,9 @@ import { useFetch } from "@common/hooks/http";
import { useNavigate } from "react-router-dom";
import { useTenantManagementContext } from "@market/contexts/TenantManagementContext";
import { $t } from "@common/locales";
+import Select, { DefaultOptionType } from "antd/es/select";
+import { useGlobalContext } from "@common/contexts/GlobalStateContext";
+import { SimpleTeamItem, MemberItem } from "@common/const/type";
export type ManagementConfigFieldType = {
name:string
@@ -21,6 +24,7 @@ type ManagementConfigProps = {
type:'add'|'edit'
teamId:string
appId?:string
+ dataShowType?:'block'|'list'
}
export type ManagementConfigHandle = {
@@ -30,16 +34,18 @@ export type ManagementConfigHandle = {
const ManagementConfig = forwardRef((props, ref) => {
const { message,modal } = App.useApp()
- const {type,teamId,appId} = props
+ const {type,teamId,appId,dataShowType} = props
const [form] = Form.useForm();
const {fetchData} = useFetch()
const [delBtnLoading, setDelBtnLoading] = useState(false)
const {setAppName} = type === 'edit' ? useTenantManagementContext():{setAppName:()=>{}}
const navigate = type === 'edit' ? useNavigate() : ()=>{}
+ const [teamOptionList, setTeamOptionList] = useState()
+ const {checkPermission,accessInit, getGlobalAccessData} = useGlobalContext()
const save:()=>Promise = ()=>{
return new Promise((resolve, reject)=>{
form.validateFields().then((value)=>{
- fetchData>(type === 'add'? 'team/app' : 'app/info',{method:type === 'add'? 'POST' : 'PUT',eoBody:(value), eoParams:type === 'add' ? {team:teamId}:{app:appId,team:teamId}}).then(response=>{
+ fetchData>(type === 'add'? 'team/app' : 'app/info',{method:type === 'add'? 'POST' : 'PUT',eoBody:(value), eoParams:type === 'add' ? {team:dataShowType === 'list' ? value.team : teamId}:{app:appId,team:teamId}}).then(response=>{
const {code,data,msg} = response
if(code === STATUS_CODE.SUCCESS){
message.success(msg || $t(RESPONSE_TIPS.success))
@@ -68,6 +74,24 @@ const ManagementConfig = forwardRef{
+ setTeamOptionList([])
+
+ fetchData>(!checkPermission('system.workspace.team.view_all') ?'simple/teams/mine' :'simple/teams',{method:'GET',eoTransformKeys:[]}).then(response=>{
+ const {code,data,msg} = response
+ if(code === STATUS_CODE.SUCCESS){
+ setTeamOptionList(data.teams?.map((x:MemberItem)=>{return {...x,
+ label:x.name, value:x.id
+ }}))
+ if(form.getFieldValue('team') === undefined&&data.teams?.length){
+ form.setFieldValue('team',data.teams[0].id);
+ }
+ }else{
+ message.error(msg || $t(RESPONSE_TIPS.error))
+ }
+ })
+ }
+
const deleteApplicationModal = async ()=>{
setDelBtnLoading(true)
modal.confirm({
@@ -112,7 +136,17 @@ const ManagementConfig = forwardRef{
+ getTeamOptionList()
+ })
+ }
}
}, [appId]);
@@ -146,6 +180,16 @@ const ManagementConfig = forwardRef
+
+ {dataShowType === 'list' &&
+ label={$t("所属团队")}
+ name="team"
+ rules={[{ required: true }]}
+ >
+
+ }
+
{
- const filterMenu = (menu:MenuItemGroupType[])=>{
+ const filterMenu = (menu:(MenuItemType&{access:string})[])=>{
const newMenu = cloneDeep(menu)
- return newMenu!.filter((m:MenuItemGroupType )=>{
- if(m&&m.children && m.children.length > 0){
- m.children = m.children.filter(
- (c)=>{
- if(!c) return false
- return (((c as MenuItemType&{access:string} ).access ?
- checkPermission((c as MenuItemType&{access:string} ).access as keyof typeof PERMISSION_DEFINITION[0]):
- true))})
- }
- return m.children && m.children.length > 0
- })
- }
- const filteredMenu = filterMenu(TENANT_MANAGEMENT_APP_MENU as MenuItemGroupType[])
+ return newMenu!.filter((c:MenuItemType&{access:string} )=>{
+ if(!c) return false
+ return (((c as MenuItemType&{access:string} ).access ?
+ checkPermission((c as MenuItemType&{access:string} ).access as keyof typeof PERMISSION_DEFINITION[0]):
+ true))
+ })}
+ const filteredMenu = filterMenu(TENANT_MANAGEMENT_APP_MENU as (MenuItemType&{access:string})[])
const menu = activeMenu ?? filteredMenu[0]?.children ? filteredMenu[0]?.children?.[0]?.key : filteredMenu[0]?.key
if(menu && currentUrl.split('/')[-1] !== menu) navigateTo(`/consumer/${teamId}/inside/${appId}/${menu}`)
return filteredMenu || []
diff --git a/frontend/packages/market/src/pages/serviceHub/management/ServiceHubManagement.tsx b/frontend/packages/market/src/pages/serviceHub/management/ServiceHubManagement.tsx
index c67d6102..97473e64 100644
--- a/frontend/packages/market/src/pages/serviceHub/management/ServiceHubManagement.tsx
+++ b/frontend/packages/market/src/pages/serviceHub/management/ServiceHubManagement.tsx
@@ -1,5 +1,5 @@
import { MenuProps, Menu, App, Avatar, Card, Tooltip, Empty, Button, Radio } from "antd";
-import { useState, forwardRef, useEffect, useRef, useMemo, memo } from "react";
+import { useState, forwardRef, useEffect, useRef, useMemo, memo, Ref, useImperativeHandle } from "react";
import { VirtuosoGrid } from "react-virtuoso";
import { BasicResponse, DATA_SHOW_TYPE_OPTIONS, RESPONSE_TIPS, STATUS_CODE } from "@common/const/const";
import { ServiceHubAppListItem } from "../../../const/serviceHub/type";
@@ -17,6 +17,7 @@ import WithPermission from "@common/components/aoplatform/WithPermission";
import InsidePage from "@common/components/aoplatform/InsidePage";
import PageList from "@common/components/aoplatform/PageList";
import { SERVICE_HUB_TABLE_COLUMNS } from "@market/const/serviceHub/const";
+import { ActionType } from "@ant-design/pro-components";
export default function ServiceHubManagement() {
const { message ,modal} = App.useApp()
@@ -36,23 +37,24 @@ export default function ServiceHubManagement() {
const [tableHttpReload, setTableHttpReload] = useState(true);
const [tableListDataSource, setTableListDataSource] = useState([]);
const [tableSearchWord, setTableSearchWord] = useState('')
+ const tableRef = useRef(null)
-const getServiceList = (dataType?:'block'|'list')=>{
- dataType = dataType ?? dataShowType
- if(!accessInit){
- getGlobalAccessData()?.then?.(()=>{getServiceList(dataType)})
- return Promise.resolve({data:[], success:false})
- }
+ const getServiceList = (dataType?:'block'|'list')=>{
+ dataType = dataType ?? dataShowType
+ if(!accessInit){
+ getGlobalAccessData()?.then?.(()=>{getServiceList(dataType)})
+ return Promise.resolve({data:[], success:false})
+ }
+
+ if(dataType === 'list' && !tableHttpReload){
+ setTableHttpReload(true)
+ return Promise.resolve({
+ data: tableListDataSource,
+ success: true,
+ });
+ }
- if(dataType === 'list' && !tableHttpReload){
- setTableHttpReload(true)
- return Promise.resolve({
- data: tableListDataSource,
- success: true,
- });
- }
-
- setServiceLoading(true)
+ setServiceLoading(true)
return fetchData>(!checkPermission('system.workspace.application.view_all') ? 'my_apps':'apps',{method:'GET',eoParams:{ team: dataType === 'list' ? undefined : teamId,keyword:tableSearchWord},eoTransformKeys:['api_num','subscribe_num','subscribe_verify_num','auth_num','create_time','can_delete']}).then(response=>{
const {code,data,msg} = response
if(code === STATUS_CODE.SUCCESS){
@@ -142,13 +144,12 @@ const getServiceList = (dataType?:'block'|'list')=>{
const openModal = async (type:'add'|'edit'|'delete')=>{
-
let title:string = ''
let content:string|React.ReactNode = ''
switch (type){
case 'add':
title=$t('添加消费者')
- content=
+ content=
break;
// case 'edit':{
// title='配置 Open Api'
@@ -174,7 +175,15 @@ const getServiceList = (dataType?:'block'|'list')=>{
onOk:()=> {
switch (type){
case 'add':
- return addManagementRef.current?.save().then((res)=>{if(res === true) getTeamsList();getServiceList()})
+ return addManagementRef.current?.save().then((res)=>{if(res === true) {
+ getTeamsList();
+ if(dataShowType === 'list'){
+ setTableHttpReload(true)
+ tableRef.current?.manualReloadTable()
+ }else{
+ getServiceList()
+ }
+ }})
// case 'edit':
// return editManagementRef.current?.save().then((res)=>{if(res === true) manualReloadTable()})
// case 'delete':
@@ -291,7 +300,7 @@ useEffect(() => {
buttonStyle="solid"
/>}
>{
- dataShowType === 'block' ? : getServiceList('list')} addNewApp={()=>openModal('add')} setTableHttpReload={setTableHttpReload} setTableSearchWord={setTableSearchWord} editApp={(row:ServiceHubAppListItem)=>{setAppName(row.name);navigateTo(`/consumer/${row.team.id}/inside/${row.id}/service`)}}/>
+ dataShowType === 'block' ? : getServiceList('list')} ref={tableRef} addNewApp={()=>openModal('add')} setTableHttpReload={setTableHttpReload} setTableSearchWord={setTableSearchWord} editApp={(row:ServiceHubAppListItem)=>{setAppName(row.name);navigateTo(`/consumer/${row.team.id}/inside/${row.id}/service`)}}/>
}
:
@@ -325,16 +334,31 @@ type TableAreaProps = {
editApp:(item:ServiceHubAppListItem)=>void
}
-const TableArea = memo(({language, getServiceList, addNewApp, setTableHttpReload, setTableSearchWord, editApp}:TableAreaProps)=>{
+type TableAreaHandle = {
+ manualReloadTable:()=>void
+}
+
+const TableArea = memo(forwardRef((props:TableAreaProps, ref:Ref)=>{
+ const {language, getServiceList, addNewApp, setTableHttpReload, setTableSearchWord, editApp} = props
+ const pageListRef = useRef(null);
const columns = useMemo(()=>{
const res = SERVICE_HUB_TABLE_COLUMNS.map(x=>{
return {...x,title:typeof x.title === 'string' ? $t(x.title as string) : x.title}})
return res
},[language])
+
+ const manualReloadTable = ()=>{
+ pageListRef.current?.reload()
+ }
+ useImperativeHandle(ref, () =>({
+ manualReloadTable}))
+
+
return (
getServiceList()}
addNewBtnTitle={$t("添加消费者")}
@@ -348,4 +372,4 @@ const TableArea = memo(({language, getServiceList, addNewApp, setTableHttpReload
}}
onRowClick={(row:ServiceHubAppListItem)=>editApp(row)}
/>
- )})
\ No newline at end of file
+ )}))
\ No newline at end of file
diff --git a/go.mod b/go.mod
index 3c8d6cad..79c4402d 100644
--- a/go.mod
+++ b/go.mod
@@ -5,9 +5,9 @@ go 1.21
//toolchain go1.21.1
require (
- github.com/eolinker/ap-account v1.0.14
+ github.com/eolinker/ap-account v1.0.15
github.com/eolinker/eosc v0.17.3
- github.com/eolinker/go-common v1.1.0
+ github.com/eolinker/go-common v1.1.1
github.com/gabriel-vasile/mimetype v1.4.4
github.com/getkin/kin-openapi v0.127.0
github.com/gin-gonic/gin v1.10.0
@@ -75,4 +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 => ../go-common
diff --git a/go.sum b/go.sum
index 40b6a55c..525ea006 100644
--- a/go.sum
+++ b/go.sum
@@ -28,12 +28,12 @@ github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/r
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
-github.com/eolinker/ap-account v1.0.14 h1:QE9LWx9F/t/BbTeBcjPX+Alzh3mdlHv+BVvKcBwr5dc=
-github.com/eolinker/ap-account v1.0.14/go.mod h1:qLKg4xervGHTNBWaGckfPkQb+FZT0XfhwPEdNpzvsjE=
+github.com/eolinker/ap-account v1.0.15 h1:n6DJeL6RHZ8eLlZUcY2U3H4d/GPaA5oelAx3R0E6yL8=
+github.com/eolinker/ap-account v1.0.15/go.mod h1:zm/Ivs6waJ/M/nEszhpPmM6g50y/MKO+5eABFAdeD0g=
github.com/eolinker/eosc v0.17.3 h1:sr2yT+v/AsqEdciRaaZZj0zL9pTufR5RvDW6+65hraQ=
github.com/eolinker/eosc v0.17.3/go.mod h1:xgq816hpanlMXFtZw7Ztdctb1eEk9UPHchY4NfFO6Cw=
-github.com/eolinker/go-common v1.1.0 h1:n/XXK7yVRen3jhNG/SfZGXJA+KNnaYf0XTDfMeviaBw=
-github.com/eolinker/go-common v1.1.0/go.mod h1:Kb/jENMN1mApnodvRgV4YwO9FJby1Jkt2EUjrBjvSX4=
+github.com/eolinker/go-common v1.1.1 h1:3WqqecGqcHDgpa8Ljp156c1uWeZKP1CKScdU+6sOfcc=
+github.com/eolinker/go-common v1.1.1/go.mod h1:Kb/jENMN1mApnodvRgV4YwO9FJby1Jkt2EUjrBjvSX4=
github.com/gabriel-vasile/mimetype v1.4.4 h1:QjV6pZ7/XZ7ryI2KuyeEDE8wnh7fHP9YnQy+R0LnH8I=
github.com/gabriel-vasile/mimetype v1.4.4/go.mod h1:JwLei5XPtWdGiMFB5Pjle1oEeoSeEuJfJE+TtfvdB/s=
github.com/getkin/kin-openapi v0.127.0 h1:Mghqi3Dhryf3F8vR370nN67pAERW+3a95vomb3MAREY=
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/module/service/dto/output.go b/module/service/dto/output.go
index 74b3ac36..d4d6e4c5 100644
--- a/module/service/dto/output.go
+++ b/module/service/dto/output.go
@@ -75,11 +75,14 @@ type App struct {
}
func ToService(model *service.Service) *Service {
-
+ prefix := "/"
+ if model.Prefix != "" {
+ prefix = model.Prefix
+ }
s := &Service{
Id: model.Id,
Name: model.Name,
- Prefix: model.Prefix,
+ Prefix: prefix,
Description: model.Description,
Team: auto.UUID(model.Team),
ServiceType: model.ServiceType.String(),
diff --git a/module/service/iml.go b/module/service/iml.go
index 04d478a1..64187a18 100644
--- a/module/service/iml.go
+++ b/module/service/iml.go
@@ -6,6 +6,13 @@ import (
"fmt"
"sort"
"strings"
+ "time"
+
+ "github.com/eolinker/eosc/log"
+
+ "github.com/APIParkLab/APIPark/resources/access"
+
+ "github.com/eolinker/ap-account/service/role"
application_authorization "github.com/APIParkLab/APIPark/service/application-authorization"
@@ -227,6 +234,7 @@ func (i *imlServiceModule) SearchMyServices(ctx context.Context, teamId string,
//}
func (i *imlServiceModule) Get(ctx context.Context, id string) (*service_dto.Service, error) {
+ now := time.Now()
serviceInfo, err := i.serviceService.Get(ctx, id)
if err != nil {
return nil, err
@@ -240,6 +248,7 @@ func (i *imlServiceModule) Get(ctx context.Context, id string) (*service_dto.Ser
s.Tags = auto.List(utils.SliceToSlice(tags, func(p *service_tag.Tag) string {
return p.Tid
}))
+ log.Infof("get service cost %d ms", time.Since(now).Milliseconds())
return s, nil
}
@@ -539,9 +548,72 @@ type imlAppModule struct {
teamMemberService team_member.ITeamMemberService `autowired:""`
subscribeService subscribe.ISubscribeService `autowired:""`
authService application_authorization.IAuthorizationService `autowired:""`
+ roleService role.IRoleService `autowired:""`
+ roleMemberService role.IRoleMemberService `autowired:""`
transaction store.ITransaction `autowired:""`
}
+func (i *imlAppModule) SearchCanSubscribe(ctx context.Context, serviceId string) ([]*service_dto.SimpleAppItem, error) {
+ apps, err := i.searchMyApps(ctx, "", "")
+ if err != nil {
+ return nil, err
+ }
+ list, err := i.roleService.ListByPermit(ctx, access.SystemWorkspaceApplicationManagerAll)
+ if err == nil && len(list) > 0 {
+ return utils.SliceToSlice(apps, func(p *service.Service) *service_dto.SimpleAppItem {
+ return &service_dto.SimpleAppItem{
+ Id: p.Id,
+ Name: p.Name,
+ Description: p.Description,
+ Team: auto.UUID(p.Team),
+ }
+ }), nil
+ }
+ list, err = i.roleService.ListByPermit(ctx, access.TeamConsumerSubscriptionSubscribe)
+ if err != nil {
+ return nil, nil
+ }
+ roleIds := utils.SliceToSlice(list, func(p *role.RoleByPermit) string {
+ return p.Id
+ })
+ members, err := i.roleMemberService.ListByRoleIds(ctx, utils.UserId(ctx), roleIds...)
+ if err != nil {
+ return nil, err
+ }
+ if len(members) == 0 {
+ return nil, nil
+ }
+ subscribes, err := i.subscribeService.ListByServices(ctx, serviceId)
+ if err != nil {
+ return nil, err
+ }
+ subscribeMap := utils.SliceToMapO(subscribes, func(p *subscribe.Subscribe) (string, struct{}) {
+ return p.Application, struct{}{}
+ }, func(s *subscribe.Subscribe) bool {
+ return s.ApplyStatus == subscribe.ApplyStatusSubscribe
+ })
+ teamMap := utils.SliceToMapO(members, func(p *role.Member) (string, struct{}) {
+ return role.TrimTeamTarget(p.Target), struct{}{}
+ })
+ result := make([]*service_dto.SimpleAppItem, 0, len(apps))
+ for _, app := range apps {
+ if _, ok := teamMap[app.Team]; !ok {
+ continue
+ }
+ if _, ok := subscribeMap[app.Id]; ok {
+ continue
+ }
+ result = append(result, &service_dto.SimpleAppItem{
+ Id: app.Id,
+ Name: app.Name,
+ Description: app.Description,
+ Team: auto.UUID(app.Team),
+ })
+ }
+
+ return result, nil
+}
+
func (i *imlAppModule) ExportAll(ctx context.Context) ([]*service_dto.ExportApp, error) {
apps, err := i.serviceService.AppList(ctx)
if err != nil {
diff --git a/module/service/module.go b/module/service/module.go
index 4ff83857..31afdede 100644
--- a/module/service/module.go
+++ b/module/service/module.go
@@ -47,6 +47,7 @@ type IAppModule interface {
UpdateApp(ctx context.Context, appId string, input *service_dto.UpdateApp) (*service_dto.App, error)
Search(ctx context.Context, teamId string, keyword string) ([]*service_dto.AppItem, error)
SearchMyApps(ctx context.Context, teamId string, keyword string) ([]*service_dto.AppItem, error)
+ SearchCanSubscribe(ctx context.Context, serviceId string) ([]*service_dto.SimpleAppItem, error)
// SimpleApps 获取简易项目列表
SimpleApps(ctx context.Context, keyword string) ([]*service_dto.SimpleAppItem, error)
MySimpleApps(ctx context.Context, keyword string) ([]*service_dto.SimpleAppItem, error)
diff --git a/plugins/core/access.go b/plugins/core/access.go
deleted file mode 100644
index 9a8bc959..00000000
--- a/plugins/core/access.go
+++ /dev/null
@@ -1 +0,0 @@
-package core
diff --git a/plugins/core/ai.go b/plugins/core/ai.go
index d1d9e602..7cae2840 100644
--- a/plugins/core/ai.go
+++ b/plugins/core/ai.go
@@ -1,19 +1,22 @@
package core
import (
- "github.com/eolinker/go-common/pm3"
"net/http"
+
+ "github.com/APIParkLab/APIPark/resources/access"
+
+ "github.com/eolinker/go-common/pm3"
)
func (p *plugin) aiAPIs() []pm3.Api {
return []pm3.Api{
- pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/ai/providers", []string{"context"}, []string{"providers"}, p.aiProviderController.Providers),
+ pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/ai/providers", []string{"context"}, []string{"providers"}, p.aiProviderController.Providers, access.SystemSettingsAiProviderView),
pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/simple/ai/providers", []string{"context"}, []string{"providers"}, p.aiProviderController.SimpleProviders),
- pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/ai/provider/config", []string{"context", "query:provider"}, []string{"provider"}, p.aiProviderController.Provider),
+ pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/ai/provider/config", []string{"context", "query:provider"}, []string{"provider"}, p.aiProviderController.Provider, access.SystemSettingsAiProviderView),
pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/ai/provider/llms", []string{"context", "query:provider"}, []string{"llms", "provider"}, p.aiProviderController.LLMs),
//pm3.CreateApiWidthDoc(http.MethodPut, "/api/v1/ai/provider/enable", []string{"context", "query:provider"}, nil, p.aiProviderController.Enable),
//pm3.CreateApiWidthDoc(http.MethodPut, "/api/v1/ai/provider/disable", []string{"context", "query:provider"}, nil, p.aiProviderController.Disable),
- pm3.CreateApiWidthDoc(http.MethodPut, "/api/v1/ai/provider/config", []string{"context", "query:provider", "body"}, nil, p.aiProviderController.UpdateProviderConfig),
- pm3.CreateApiWidthDoc(http.MethodPut, "/api/v1/ai/provider/default-llm", []string{"context", "query:provider", "body"}, nil, p.aiProviderController.UpdateProviderDefaultLLM),
+ pm3.CreateApiWidthDoc(http.MethodPut, "/api/v1/ai/provider/config", []string{"context", "query:provider", "body"}, nil, p.aiProviderController.UpdateProviderConfig, access.SystemSettingsAiProviderManager),
+ //pm3.CreateApiWidthDoc(http.MethodPut, "/api/v1/ai/provider/default-llm", []string{"context", "query:provider", "body"}, nil, p.aiProviderController.UpdateProviderDefaultLLM),
}
}
diff --git a/plugins/core/api.go b/plugins/core/api.go
index 4655573f..666cf769 100644
--- a/plugins/core/api.go
+++ b/plugins/core/api.go
@@ -3,27 +3,28 @@ package core
import (
"net/http"
+ "github.com/APIParkLab/APIPark/resources/access"
"github.com/eolinker/go-common/pm3"
)
func (p *plugin) apiApis() []pm3.Api {
return []pm3.Api{
- pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/service/routers", []string{"context", "query:keyword", "query:service"}, []string{"routers"}, p.routerController.Search),
- pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/service/router/detail", []string{"context", "query:service", "query:router"}, []string{"router"}, p.routerController.Detail),
- pm3.CreateApiWidthDoc(http.MethodPost, "/api/v1/service/router", []string{"context", "query:service", "body"}, []string{"router"}, p.routerController.Create),
- pm3.CreateApiWidthDoc(http.MethodPut, "/api/v1/service/router", []string{"context", "query:service", "query:router", "body"}, []string{"router"}, p.routerController.Edit),
- pm3.CreateApiWidthDoc(http.MethodDelete, "/api/v1/service/router", []string{"context", "query:service", "query:router"}, nil, p.routerController.Delete),
+ pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/service/routers", []string{"context", "query:keyword", "query:service"}, []string{"routers"}, p.routerController.Search, access.SystemWorkspaceServiceViewAll, access.TeamServiceApiView),
+ pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/service/router/detail", []string{"context", "query:service", "query:router"}, []string{"router"}, p.routerController.Detail, access.SystemWorkspaceServiceViewAll, access.TeamServiceApiView),
+ pm3.CreateApiWidthDoc(http.MethodPost, "/api/v1/service/router", []string{"context", "query:service", "body"}, []string{"router"}, p.routerController.Create, access.SystemWorkspaceServiceManagerAll, access.TeamServiceApiManager),
+ pm3.CreateApiWidthDoc(http.MethodPut, "/api/v1/service/router", []string{"context", "query:service", "query:router", "body"}, []string{"router"}, p.routerController.Edit, access.SystemWorkspaceServiceManagerAll, access.TeamServiceApiManager),
+ pm3.CreateApiWidthDoc(http.MethodDelete, "/api/v1/service/router", []string{"context", "query:service", "query:router"}, nil, p.routerController.Delete, access.SystemWorkspaceServiceManagerAll, access.TeamServiceApiManager),
pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/service/router/define", []string{"context", "query:service"}, []string{"prefix", "force"}, p.routerController.Prefix),
- pm3.CreateApiWidthDoc(http.MethodPut, "/api/v1/service/api_doc", []string{"context", "query:service", "body"}, []string{"doc"}, p.apiDocController.UpdateDoc),
- pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/service/api_doc", []string{"context", "query:service"}, []string{"doc"}, p.apiDocController.GetDoc),
+ pm3.CreateApiWidthDoc(http.MethodPut, "/api/v1/service/api_doc", []string{"context", "query:service", "body"}, []string{"doc"}, p.apiDocController.UpdateDoc, access.SystemWorkspaceServiceManagerAll, access.TeamServiceApiDocManager),
+ pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/service/api_doc", []string{"context", "query:service"}, []string{"doc"}, p.apiDocController.GetDoc, access.SystemWorkspaceServiceViewAll, access.TeamServiceApiDocView),
- pm3.CreateApiWidthDoc(http.MethodPost, "/api/v1/service/api_doc/upload", []string{"context", "query:service"}, []string{"doc"}, p.apiDocController.UploadDoc),
+ pm3.CreateApiWidthDoc(http.MethodPost, "/api/v1/service/api_doc/upload", []string{"context", "query:service"}, []string{"doc"}, p.apiDocController.UploadDoc, access.SystemWorkspaceServiceManagerAll, access.TeamServiceApiDocManager),
- pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/service/ai-router", []string{"context", "query:service", "query:router"}, []string{"api"}, p.aiAPIController.Get),
- pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/service/ai-routers", []string{"context", "query:keyword", "query:service"}, []string{"apis"}, p.aiAPIController.List),
- pm3.CreateApiWidthDoc(http.MethodPut, "/api/v1/service/ai-router", []string{"context", "query:service", "query:router", "body"}, []string{"api"}, p.aiAPIController.Edit),
- pm3.CreateApiWidthDoc(http.MethodPost, "/api/v1/service/ai-router", []string{"context", "query:service", "body"}, []string{"api"}, p.aiAPIController.Create),
- pm3.CreateApiWidthDoc(http.MethodDelete, "/api/v1/service/ai-router", []string{"context", "query:service", "query:router"}, nil, p.aiAPIController.Delete),
+ pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/service/ai-router", []string{"context", "query:service", "query:router"}, []string{"api"}, p.aiAPIController.Get, access.SystemWorkspaceServiceViewAll, access.TeamServiceApiView),
+ pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/service/ai-routers", []string{"context", "query:keyword", "query:service"}, []string{"apis"}, p.aiAPIController.List, access.SystemWorkspaceServiceViewAll, access.TeamServiceApiView),
+ pm3.CreateApiWidthDoc(http.MethodPut, "/api/v1/service/ai-router", []string{"context", "query:service", "query:router", "body"}, []string{"api"}, p.aiAPIController.Edit, access.SystemWorkspaceServiceManagerAll, access.TeamServiceApiManager),
+ pm3.CreateApiWidthDoc(http.MethodPost, "/api/v1/service/ai-router", []string{"context", "query:service", "body"}, []string{"api"}, p.aiAPIController.Create, access.SystemWorkspaceServiceManagerAll, access.TeamServiceApiManager),
+ pm3.CreateApiWidthDoc(http.MethodDelete, "/api/v1/service/ai-router", []string{"context", "query:service", "query:router"}, nil, p.aiAPIController.Delete, access.SystemWorkspaceServiceManagerAll, access.TeamServiceApiManager),
}
}
diff --git a/plugins/core/project-authorization.go b/plugins/core/authorization.go
similarity index 50%
rename from plugins/core/project-authorization.go
rename to plugins/core/authorization.go
index e2ad3db7..0754c5e3 100644
--- a/plugins/core/project-authorization.go
+++ b/plugins/core/authorization.go
@@ -3,16 +3,17 @@ package core
import (
"net/http"
+ "github.com/APIParkLab/APIPark/resources/access"
"github.com/eolinker/go-common/pm3"
)
-func (p *plugin) projectAuthorizationApis() []pm3.Api {
+func (p *plugin) appAuthorizationApis() []pm3.Api {
return []pm3.Api{
- pm3.CreateApiWidthDoc(http.MethodPost, "/api/v1/app/authorization", []string{"context", "query:app", "body"}, []string{"authorization"}, p.appAuthorizationController.AddAuthorization),
- pm3.CreateApiWidthDoc(http.MethodPut, "/api/v1/app/authorization", []string{"context", "query:app", "query:authorization", "body"}, []string{"authorization"}, p.appAuthorizationController.EditAuthorization),
- pm3.CreateApiWidthDoc(http.MethodDelete, "/api/v1/app/authorization", []string{"context", "query:app", "query:authorization"}, nil, p.appAuthorizationController.DeleteAuthorization),
- pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/app/authorization", []string{"context", "query:app", "query:authorization"}, []string{"authorization"}, p.appAuthorizationController.Info),
- pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/app/authorizations", []string{"context", "query:app"}, []string{"authorizations"}, p.appAuthorizationController.Authorizations),
- pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/app/authorization/details", []string{"context", "query:app", "query:authorization"}, []string{"details"}, p.appAuthorizationController.Detail),
+ pm3.CreateApiWidthDoc(http.MethodPost, "/api/v1/app/authorization", []string{"context", "query:app", "body"}, []string{"authorization"}, p.appAuthorizationController.AddAuthorization, access.SystemWorkspaceApplicationManagerAll, access.TeamConsumerAuthorizationManager),
+ pm3.CreateApiWidthDoc(http.MethodPut, "/api/v1/app/authorization", []string{"context", "query:app", "query:authorization", "body"}, []string{"authorization"}, p.appAuthorizationController.EditAuthorization, access.SystemWorkspaceApplicationManagerAll, access.TeamConsumerAuthorizationManager),
+ pm3.CreateApiWidthDoc(http.MethodDelete, "/api/v1/app/authorization", []string{"context", "query:app", "query:authorization"}, nil, p.appAuthorizationController.DeleteAuthorization, access.SystemWorkspaceApplicationManagerAll, access.TeamConsumerAuthorizationManager),
+ pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/app/authorization", []string{"context", "query:app", "query:authorization"}, []string{"authorization"}, p.appAuthorizationController.Info, access.SystemWorkspaceApplicationViewAll, access.TeamConsumerAuthorizationView),
+ pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/app/authorizations", []string{"context", "query:app"}, []string{"authorizations"}, p.appAuthorizationController.Authorizations, access.SystemWorkspaceApplicationViewAll, access.TeamConsumerAuthorizationView),
+ pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/app/authorization/details", []string{"context", "query:app", "query:authorization"}, []string{"details"}, p.appAuthorizationController.Detail, access.SystemWorkspaceApplicationViewAll, access.TeamConsumerAuthorizationView),
}
}
diff --git a/plugins/core/certificate.go b/plugins/core/certificate.go
index cb3fa5eb..d9514316 100644
--- a/plugins/core/certificate.go
+++ b/plugins/core/certificate.go
@@ -3,15 +3,16 @@ package core
import (
"net/http"
+ "github.com/APIParkLab/APIPark/resources/access"
"github.com/eolinker/go-common/pm3"
)
func (p *plugin) certificateApi() []pm3.Api {
return []pm3.Api{
- pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/certificates", []string{"context"}, []string{"certificates"}, p.certificateController.ListForPartition),
- pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/certificate", []string{"context", "query:id"}, []string{"certificate", "cert"}, p.certificateController.Detail),
- pm3.CreateApiWidthDoc(http.MethodPost, "/api/v1/certificate", []string{"context", "body"}, nil, p.certificateController.Create),
- pm3.CreateApiWidthDoc(http.MethodPut, "/api/v1/certificate", []string{"context", "query:id", "body"}, nil, p.certificateController.Update),
- pm3.CreateApiWidthDoc(http.MethodDelete, "/api/v1/certificate", []string{"context", "query:id"}, []string{"id"}, p.certificateController.Delete),
+ pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/certificates", []string{"context"}, []string{"certificates"}, p.certificateController.ListForPartition, access.SystemSettingsSslCertificateView),
+ pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/certificate", []string{"context", "query:id"}, []string{"certificate", "cert"}, p.certificateController.Detail, access.SystemSettingsSslCertificateView),
+ pm3.CreateApiWidthDoc(http.MethodPost, "/api/v1/certificate", []string{"context", "body"}, nil, p.certificateController.Create, access.SystemSettingsSslCertificateManager),
+ pm3.CreateApiWidthDoc(http.MethodPut, "/api/v1/certificate", []string{"context", "query:id", "body"}, nil, p.certificateController.Update, access.SystemSettingsSslCertificateManager),
+ pm3.CreateApiWidthDoc(http.MethodDelete, "/api/v1/certificate", []string{"context", "query:id"}, []string{"id"}, p.certificateController.Delete, access.SystemSettingsSslCertificateManager),
}
}
diff --git a/plugins/core/cluster.go b/plugins/core/cluster.go
index 7708b264..0316ead6 100644
--- a/plugins/core/cluster.go
+++ b/plugins/core/cluster.go
@@ -3,13 +3,14 @@ package core
import (
"net/http"
+ "github.com/APIParkLab/APIPark/resources/access"
"github.com/eolinker/go-common/pm3"
)
func (p *plugin) clusterApi() []pm3.Api {
return []pm3.Api{
- pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/cluster/nodes", []string{"context", "query:partition"}, []string{"nodes"}, p.clusterController.Nodes),
- pm3.CreateApiWidthDoc(http.MethodPut, "/api/v1/cluster/reset", []string{"context", "query:partition", "body"}, []string{"nodes"}, p.clusterController.ResetCluster),
- pm3.CreateApiWidthDoc(http.MethodPost, "/api/v1/cluster/check", []string{"context", "body"}, []string{"nodes"}, p.clusterController.Check),
+ pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/cluster/nodes", []string{"context", "query:partition"}, []string{"nodes"}, p.clusterController.Nodes, access.SystemSettingsApiGatewayView),
+ pm3.CreateApiWidthDoc(http.MethodPut, "/api/v1/cluster/reset", []string{"context", "query:partition", "body"}, []string{"nodes"}, p.clusterController.ResetCluster, access.SystemSettingsApiGatewayManager),
+ pm3.CreateApiWidthDoc(http.MethodPost, "/api/v1/cluster/check", []string{"context", "body"}, []string{"nodes"}, p.clusterController.Check, access.SystemSettingsApiGatewayManager),
}
}
diff --git a/plugins/core/core.go b/plugins/core/core.go
index e194b191..8d7168ca 100644
--- a/plugins/core/core.go
+++ b/plugins/core/core.go
@@ -97,7 +97,7 @@ func (p *plugin) OnComplete() {
p.apis = append(p.apis, p.upstreamApis()...)
p.apis = append(p.apis, p.apiApis()...)
p.apis = append(p.apis, p.subscribeApis()...)
- p.apis = append(p.apis, p.projectAuthorizationApis()...)
+ p.apis = append(p.apis, p.appAuthorizationApis()...)
p.apis = append(p.apis, p.releaseApis()...)
p.apis = append(p.apis, p.DynamicModuleApis()...)
p.apis = append(p.apis, p.monitorStatisticApis()...)
diff --git a/plugins/core/monitor.go b/plugins/core/monitor.go
index ca6025b1..5b8a53e1 100644
--- a/plugins/core/monitor.go
+++ b/plugins/core/monitor.go
@@ -3,18 +3,19 @@ package core
import (
"net/http"
+ "github.com/APIParkLab/APIPark/resources/access"
"github.com/eolinker/go-common/pm3"
)
func (p *plugin) monitorStatisticApis() []pm3.Api {
return []pm3.Api{
- pm3.CreateApiWidthDoc(http.MethodPost, "/api/v1/monitor/overview/top10", []string{"context", "body"}, []string{"top10"}, p.monitorStatisticController.Top10),
- pm3.CreateApiWidthDoc(http.MethodPost, "/api/v1/monitor/overview/summary", []string{"context", "body"}, []string{"request_summary", "proxy_summary"}, p.monitorStatisticController.Summary),
- pm3.CreateApiWidthDoc(http.MethodPost, "/api/v1/monitor/overview/invoke", []string{"context", "body"}, []string{"date", "request_total", "proxy_total", "status_4xx", "status_5xx", "request_rate", "proxy_rate", "time_interval"}, p.monitorStatisticController.OverviewInvokeTrend),
- pm3.CreateApiWidthDoc(http.MethodPost, "/api/v1/monitor/overview/message", []string{"context", "body"}, []string{"date", "request_message", "response_message", "time_interval"}, p.monitorStatisticController.OverviewMessageTrend),
+ pm3.CreateApiWidthDoc(http.MethodPost, "/api/v1/monitor/overview/top10", []string{"context", "body"}, []string{"top10"}, p.monitorStatisticController.Top10, access.SystemAnalysisRunViewView),
+ pm3.CreateApiWidthDoc(http.MethodPost, "/api/v1/monitor/overview/summary", []string{"context", "body"}, []string{"request_summary", "proxy_summary"}, p.monitorStatisticController.Summary, access.SystemAnalysisRunViewView),
+ pm3.CreateApiWidthDoc(http.MethodPost, "/api/v1/monitor/overview/invoke", []string{"context", "body"}, []string{"date", "request_total", "proxy_total", "status_4xx", "status_5xx", "request_rate", "proxy_rate", "time_interval"}, p.monitorStatisticController.OverviewInvokeTrend, access.SystemAnalysisRunViewView),
+ pm3.CreateApiWidthDoc(http.MethodPost, "/api/v1/monitor/overview/message", []string{"context", "body"}, []string{"date", "request_message", "response_message", "time_interval"}, p.monitorStatisticController.OverviewMessageTrend, access.SystemAnalysisRunViewView),
- pm3.CreateApiWidthDoc(http.MethodPost, "/api/v1/monitor/config", []string{"context", "body"}, []string{"info"}, p.monitorConfigController.SaveMonitorConfig),
- pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/monitor/config", []string{"context"}, []string{"info"}, p.monitorConfigController.GetMonitorConfig),
+ pm3.CreateApiWidthDoc(http.MethodPost, "/api/v1/monitor/config", []string{"context", "body"}, []string{"info"}, p.monitorConfigController.SaveMonitorConfig, access.SystemSettingsDataSourceManager),
+ pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/monitor/config", []string{"context"}, []string{"info"}, p.monitorConfigController.GetMonitorConfig, access.SystemSettingsDataSourceView),
pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/simple/monitor/clusters", []string{"context"}, []string{"clusters"}, p.monitorConfigController.GetMonitorCluster),
}
}
diff --git a/plugins/core/my-team.go b/plugins/core/my-team.go
index 68ef6c4f..e8d963a0 100644
--- a/plugins/core/my-team.go
+++ b/plugins/core/my-team.go
@@ -3,27 +3,28 @@ package core
import (
"net/http"
+ "github.com/APIParkLab/APIPark/resources/access"
"github.com/eolinker/go-common/pm3"
)
func (p *plugin) MyTeamApi() []pm3.Api {
return []pm3.Api{
- pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/team", []string{"context", "query:team"}, []string{"team"}, p.myTeamController.GetTeam),
+ pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/team", []string{"context", "query:team"}, []string{"team"}, p.myTeamController.GetTeam, access.SystemWorkspaceTeamViewAll, access.TeamTeamTeamView),
pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/teams", []string{"context", "query:keyword"}, []string{"teams"}, p.myTeamController.Search),
pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/simple/teams/mine", []string{"context", "query:keyword"}, []string{"teams"}, p.myTeamController.MySimpleTeams),
pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/simple/teams", []string{"context", "query:keyword"}, []string{"teams"}, p.myTeamController.SimpleTeams),
pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/team/members/simple", []string{"context", "query:team", "query:keyword"}, []string{"teams"}, p.myTeamController.SimpleMembers),
- pm3.CreateApiWidthDoc(http.MethodPut, "/api/v1/team", []string{"context", "query:team", "body"}, []string{"team"}, p.myTeamController.EditTeam),
- pm3.CreateApiWidthDoc(http.MethodPost, "/api/v1/team/member", []string{"context", "query:team", "body"}, nil, p.myTeamController.AddMember),
- pm3.CreateApiWidthDoc(http.MethodDelete, "/api/v1/team/member", []string{"context", "query:team", "query:user"}, nil, p.myTeamController.RemoveMember),
- pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/team/members", []string{"context", "query:team", "query:keyword"}, []string{"members"}, p.myTeamController.Members),
+ pm3.CreateApiWidthDoc(http.MethodPut, "/api/v1/team", []string{"context", "query:team", "body"}, []string{"team"}, p.myTeamController.EditTeam, access.SystemWorkspaceTeamManager, access.TeamTeamTeamManager),
+ pm3.CreateApiWidthDoc(http.MethodPost, "/api/v1/team/member", []string{"context", "query:team", "body"}, nil, p.myTeamController.AddMember, access.SystemWorkspaceTeamManager, access.TeamTeamMemberManager),
+ pm3.CreateApiWidthDoc(http.MethodDelete, "/api/v1/team/member", []string{"context", "query:team", "query:user"}, nil, p.myTeamController.RemoveMember, access.SystemWorkspaceTeamManager, access.TeamTeamMemberManager),
+ pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/team/members", []string{"context", "query:team", "query:keyword"}, []string{"members"}, p.myTeamController.Members, access.SystemWorkspaceTeamViewAll, access.TeamTeamMemberView),
- pm3.CreateApiWidthDoc(http.MethodPut, "/api/v1/team/member/role", []string{"context", "query:team", "body"}, nil, p.myTeamController.UpdateMemberRole),
+ pm3.CreateApiWidthDoc(http.MethodPut, "/api/v1/team/member/role", []string{"context", "query:team", "body"}, nil, p.myTeamController.UpdateMemberRole, access.SystemWorkspaceTeamManager, access.TeamTeamMemberManager),
// 团队项目操作
- pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/team/services", []string{"context", "query:team", "query:keyword"}, []string{"services"}, p.serviceController.Search),
- pm3.CreateApiWidthDoc(http.MethodPost, "/api/v1/team/service", []string{"context", "query:team", "body"}, []string{"service"}, p.serviceController.Create),
- pm3.CreateApiWidthDoc(http.MethodPost, "/api/v1/team/app", []string{"context", "query:team", "body"}, []string{"app"}, p.appController.CreateApp),
- pm3.CreateApiWidthDoc(http.MethodDelete, "/api/v1/team/service", []string{"context", "query:service"}, nil, p.serviceController.Delete),
+ pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/team/services", []string{"context", "query:team", "query:keyword"}, []string{"services"}, p.serviceController.Search, access.SystemWorkspaceServiceViewAll, access.TeamTeamServiceView),
+ pm3.CreateApiWidthDoc(http.MethodPost, "/api/v1/team/service", []string{"context", "query:team", "body"}, []string{"service"}, p.serviceController.Create, access.SystemWorkspaceServiceManagerAll, access.TeamTeamServiceManager),
+ pm3.CreateApiWidthDoc(http.MethodPost, "/api/v1/team/app", []string{"context", "query:team", "body"}, []string{"app"}, p.appController.CreateApp, access.SystemWorkspaceApplicationManagerAll, access.TeamTeamConsumerManager),
+ pm3.CreateApiWidthDoc(http.MethodDelete, "/api/v1/team/service", []string{"context", "query:service"}, nil, p.serviceController.Delete, access.SystemWorkspaceServiceManagerAll, access.TeamTeamServiceManager),
}
}
diff --git a/plugins/core/release.go b/plugins/core/release.go
index 750d6bfd..3a0f365a 100644
--- a/plugins/core/release.go
+++ b/plugins/core/release.go
@@ -3,16 +3,17 @@ package core
import (
"net/http"
+ "github.com/APIParkLab/APIPark/resources/access"
"github.com/eolinker/go-common/pm3"
)
func (p *plugin) releaseApis() []pm3.Api {
return []pm3.Api{
- pm3.CreateApiWidthDoc(http.MethodPost, "/api/v1/service/release", []string{"context", "query:service", "body"}, []string{}, p.releaseController.Create),
- pm3.CreateApiWidthDoc(http.MethodDelete, "/api/v1/service/release", []string{"context", "query:service", "query:id"}, []string{}, p.releaseController.Delete),
- pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/service/release", []string{"context", "query:service", "query:id"}, []string{"release"}, p.releaseController.Detail),
- pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/service/releases", []string{"context", "query:service"}, []string{"releases"}, p.releaseController.List),
- pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/service/release/preview", []string{"context", "query:service"}, []string{"running", "diff", "complete"}, p.releaseController.Preview),
+ pm3.CreateApiWidthDoc(http.MethodPost, "/api/v1/service/release", []string{"context", "query:service", "body"}, []string{}, p.releaseController.Create, access.SystemWorkspaceServiceManagerAll, access.TeamServiceReleaseManager),
+ pm3.CreateApiWidthDoc(http.MethodDelete, "/api/v1/service/release", []string{"context", "query:service", "query:id"}, []string{}, p.releaseController.Delete, access.SystemWorkspaceServiceManagerAll, access.TeamServiceReleaseManager),
+ pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/service/release", []string{"context", "query:service", "query:id"}, []string{"release"}, p.releaseController.Detail, access.SystemWorkspaceServiceViewAll, access.TeamServiceReleaseView),
+ pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/service/releases", []string{"context", "query:service"}, []string{"releases"}, p.releaseController.List, access.SystemWorkspaceServiceViewAll, access.TeamServiceReleaseView),
+ pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/service/release/preview", []string{"context", "query:service"}, []string{"running", "diff", "complete"}, p.releaseController.Preview, access.SystemWorkspaceServiceViewAll, access.TeamServiceReleaseView),
}
}
diff --git a/plugins/core/service.go b/plugins/core/service.go
index 3d42ffba..774ed852 100644
--- a/plugins/core/service.go
+++ b/plugins/core/service.go
@@ -3,40 +3,29 @@ package core
import (
"net/http"
+ "github.com/APIParkLab/APIPark/resources/access"
"github.com/eolinker/go-common/pm3"
)
func (p *plugin) ServiceApis() []pm3.Api {
return []pm3.Api{
// 项目
- pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/service/info", []string{"context", "query:service"}, []string{"service"}, p.serviceController.Get),
- pm3.CreateApiWidthDoc(http.MethodPut, "/api/v1/service/info", []string{"context", "query:service", "body"}, []string{"service"}, p.serviceController.Edit),
- pm3.CreateApiWidthDoc(http.MethodDelete, "/api/v1/service/info", []string{"context", "query:service"}, nil, p.serviceController.Delete),
+ pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/service/info", []string{"context", "query:service"}, []string{"service"}, p.serviceController.Get, access.SystemWorkspaceServiceViewAll, access.TeamTeamServiceView),
+ pm3.CreateApiWidthDoc(http.MethodPut, "/api/v1/service/info", []string{"context", "query:service", "body"}, []string{"service"}, p.serviceController.Edit, access.SystemWorkspaceServiceManagerAll, access.TeamTeamServiceManager),
+ pm3.CreateApiWidthDoc(http.MethodDelete, "/api/v1/service/info", []string{"context", "query:service"}, nil, p.serviceController.Delete, access.SystemWorkspaceServiceManagerAll, access.TeamTeamServiceManager),
pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/my_services", []string{"context", "query:team", "query:keyword"}, []string{"services"}, p.serviceController.SearchMyServices),
- pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/services", []string{"context", "query:team", "query:keyword"}, []string{"services"}, p.serviceController.Search),
-
- //pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/simple/services/mine", []string{"context", "query:keyword"}, []string{"services"}, p.serviceController.MySimple),
- //
- //pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/simple/services", []string{"context", "query:keyword"}, []string{"services"}, p.serviceController.Simple),
-
- // AI服务
- //pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/ai-services", []string{"context", "query:service", "query:keyword"}, []string{"services"}, p.serviceController.SearchAIServices),
- //pm3.CreateApiWidthDoc(http.MethodPost, "/api/v1/team/ai-service", []string{"context", "query:team", "body"}, []string{"service"}, p.serviceController.CreateAIService),
- //pm3.CreateApiWidthDoc(http.MethodPut, "/api/v1/ai-service/info", []string{"context", "query:service", "body"}, []string{"service"}, p.serviceController.EditAIService),
- //pm3.CreateApiWidthDoc(http.MethodDelete, "/api/v1/team/ai-service", []string{"context", "query:service"}, nil, p.serviceController.DeleteAIService),
- //pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/my_ai_services", []string{"context", "query:team", "query:keyword"}, []string{"services"}, p.serviceController.SearchMyAIServices),
- //pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/ai-service/info", []string{"context", "query:service"}, []string{"service"}, p.serviceController.Get),
-
+ pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/services", []string{"context", "query:team", "query:keyword"}, []string{"services"}, p.serviceController.Search, access.SystemWorkspaceServiceViewAll, access.TeamTeamServiceView),
// 应用相关
- pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/app/info", []string{"context", "query:app"}, []string{"app"}, p.appController.GetApp),
- pm3.CreateApiWidthDoc(http.MethodDelete, "/api/v1/app", []string{"context", "query:app"}, nil, p.appController.DeleteApp),
+ pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/app/info", []string{"context", "query:app"}, []string{"app"}, p.appController.GetApp, access.SystemWorkspaceApplicationViewAll, access.TeamTeamConsumerView),
+ pm3.CreateApiWidthDoc(http.MethodDelete, "/api/v1/app", []string{"context", "query:app"}, nil, p.appController.DeleteApp, access.SystemWorkspaceApplicationManagerAll, access.TeamTeamConsumerManager),
pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/simple/apps", []string{"context", "query:keyword"}, []string{"apps"}, p.appController.SimpleApps),
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),
- pm3.CreateApiWidthDoc(http.MethodPut, "/api/v1/app/info", []string{"context", "query:app", "body"}, []string{"app"}, p.appController.UpdateApp),
+ 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: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),
- pm3.CreateApiWidthDoc(http.MethodPut, "/api/v1/service/doc", []string{"context", "query:service", "body"}, nil, p.serviceController.SaveServiceDoc),
+ pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/service/doc", []string{"context", "query:service"}, []string{"doc"}, p.serviceController.ServiceDoc, access.SystemWorkspaceServiceViewAll, access.TeamServiceServiceIntroView),
+ pm3.CreateApiWidthDoc(http.MethodPut, "/api/v1/service/doc", []string{"context", "query:service", "body"}, nil, p.serviceController.SaveServiceDoc, access.SystemWorkspaceServiceManagerAll, access.TeamServiceServiceIntroManager),
}
}
diff --git a/plugins/core/square.go b/plugins/core/square.go
index 486858ef..f58cca1e 100644
--- a/plugins/core/square.go
+++ b/plugins/core/square.go
@@ -3,18 +3,19 @@ package core
import (
"net/http"
+ "github.com/APIParkLab/APIPark/resources/access"
"github.com/eolinker/go-common/pm3"
)
func (p *plugin) catalogueApi() []pm3.Api {
return []pm3.Api{
- pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/catalogues", []string{"context", "query:keyword"}, []string{"catalogues", "tags"}, p.catalogueController.Search),
- pm3.CreateApiWidthDoc(http.MethodPost, "/api/v1/catalogue", []string{"context", "body"}, nil, p.catalogueController.Create),
- pm3.CreateApiWidthDoc(http.MethodPut, "/api/v1/catalogue", []string{"context", "query:catalogue", "body"}, nil, p.catalogueController.Edit),
- pm3.CreateApiWidthDoc(http.MethodDelete, "/api/v1/catalogue", []string{"context", "query:catalogue"}, nil, p.catalogueController.Delete),
- pm3.CreateApiWidthDoc(http.MethodPut, "/api/v1/catalogue/sort", []string{"context", "body"}, nil, p.catalogueController.Sort),
- pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/catalogue/services", []string{"context", "query:keyword"}, []string{"services"}, p.catalogueController.Services),
- pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/catalogue/service", []string{"context", "query:service"}, []string{"service"}, p.catalogueController.ServiceDetail),
+ pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/catalogues", []string{"context", "query:keyword"}, []string{"catalogues", "tags"}, p.catalogueController.Search, access.SystemSettingsGeneralView, access.SystemApiPortalApiPortalView),
+ pm3.CreateApiWidthDoc(http.MethodPost, "/api/v1/catalogue", []string{"context", "body"}, nil, p.catalogueController.Create, access.SystemSettingsGeneralManager),
+ pm3.CreateApiWidthDoc(http.MethodPut, "/api/v1/catalogue", []string{"context", "query:catalogue", "body"}, nil, p.catalogueController.Edit, access.SystemSettingsGeneralManager),
+ pm3.CreateApiWidthDoc(http.MethodDelete, "/api/v1/catalogue", []string{"context", "query:catalogue"}, nil, p.catalogueController.Delete, access.SystemSettingsGeneralManager),
+ pm3.CreateApiWidthDoc(http.MethodPut, "/api/v1/catalogue/sort", []string{"context", "body"}, nil, p.catalogueController.Sort, access.SystemSettingsGeneralManager),
+ pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/catalogue/services", []string{"context", "query:keyword"}, []string{"services"}, p.catalogueController.Services, access.SystemApiPortalApiPortalView),
+ pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/catalogue/service", []string{"context", "query:service"}, []string{"service"}, p.catalogueController.ServiceDetail, access.SystemApiPortalApiPortalView),
pm3.CreateApiWidthDoc(http.MethodPost, "/api/v1/catalogue/service/subscribe", []string{"context", "body"}, nil, p.catalogueController.Subscribe),
}
}
diff --git a/plugins/core/subscribe.go b/plugins/core/subscribe.go
index 643a4142..a068ddbb 100644
--- a/plugins/core/subscribe.go
+++ b/plugins/core/subscribe.go
@@ -3,23 +3,25 @@ package core
import (
"net/http"
+ "github.com/APIParkLab/APIPark/resources/access"
+
"github.com/eolinker/go-common/pm3"
)
func (p *plugin) subscribeApis() []pm3.Api {
return []pm3.Api{
- pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/service/subscribers", []string{"context", "query:service", "query:keyword"}, []string{"subscribers"}, p.subscribeController.Search),
+ pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/service/subscribers", []string{"context", "query:service", "query:keyword"}, []string{"subscribers"}, p.subscribeController.Search, access.SystemWorkspaceServiceViewAll, access.TeamServiceSubscriptionView),
- pm3.CreateApiWidthDoc(http.MethodPost, "/api/v1/service/subscriber", []string{"context", "query:service", "body"}, nil, p.subscribeController.AddSubscriber),
- pm3.CreateApiWidthDoc(http.MethodDelete, "/api/v1/service/subscriber", []string{"context", "query:service", "query:service", "query:application"}, nil, p.subscribeController.DeleteSubscriber),
+ pm3.CreateApiWidthDoc(http.MethodPost, "/api/v1/service/subscriber", []string{"context", "query:service", "body"}, nil, p.subscribeController.AddSubscriber, access.SystemWorkspaceServiceManagerAll, access.TeamServiceSubscriptionManager),
+ pm3.CreateApiWidthDoc(http.MethodDelete, "/api/v1/service/subscriber", []string{"context", "query:service", "query:service", "query:application"}, nil, p.subscribeController.DeleteSubscriber, access.SystemWorkspaceServiceManagerAll, access.TeamServiceSubscriptionManager),
- pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/application/subscriptions", []string{"context", "query:application", "query:keyword"}, []string{"subscriptions"}, p.subscribeController.SearchSubscriptions),
- pm3.CreateApiWidthDoc(http.MethodPost, "/api/v1/application/subscription/cancel", []string{"context", "query:application", "query:subscription"}, nil, p.subscribeController.RevokeSubscription),
- pm3.CreateApiWidthDoc(http.MethodPost, "/api/v1/application/subscription/cancel_apply", []string{"context", "query:application", "query:subscription"}, nil, p.subscribeController.RevokeApply),
+ pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/application/subscriptions", []string{"context", "query:application", "query:keyword"}, []string{"subscriptions"}, p.subscribeController.SearchSubscriptions, access.SystemWorkspaceApplicationViewAll, access.TeamConsumerSubscriptionViewSubscribed),
+ pm3.CreateApiWidthDoc(http.MethodPost, "/api/v1/application/subscription/cancel", []string{"context", "query:application", "query:subscription"}, nil, p.subscribeController.RevokeSubscription, access.SystemWorkspaceApplicationManagerAll, access.TeamConsumerSubscriptionSubscribe, access.TeamConsumerSubscriptionManagerSubscribed),
+ pm3.CreateApiWidthDoc(http.MethodPost, "/api/v1/application/subscription/cancel_apply", []string{"context", "query:application", "query:subscription"}, nil, p.subscribeController.RevokeApply, access.SystemWorkspaceApplicationManagerAll, access.TeamConsumerSubscriptionSubscribe, access.TeamConsumerSubscriptionManagerSubscribed),
// 审核相关
- pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/service/approval/subscribes", []string{"context", "query:service", "query:status"}, []string{"approvals"}, p.subscribeApprovalController.GetApprovalList),
- pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/service/approval/subscribe", []string{"context", "query:service", "query:apply"}, []string{"approval"}, p.subscribeApprovalController.GetApprovalDetail),
+ pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/service/approval/subscribes", []string{"context", "query:service", "query:status"}, []string{"approvals"}, p.subscribeApprovalController.GetApprovalList, access.SystemWorkspaceServiceViewAll, access.TeamServiceSubscriptionView),
+ pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/service/approval/subscribe", []string{"context", "query:service", "query:apply"}, []string{"approval"}, p.subscribeApprovalController.GetApprovalDetail, access.SystemWorkspaceServiceViewAll, access.TeamServiceSubscriptionView),
pm3.CreateApiWidthDoc(http.MethodPost, "/api/v1/service/approval/subscribe", []string{"context", "query:service", "query:apply", "body"}, nil, p.subscribeApprovalController.Approval),
}
}
diff --git a/plugins/core/team-manager.go b/plugins/core/team-manager.go
index 7c03c9d2..f13d8e3a 100644
--- a/plugins/core/team-manager.go
+++ b/plugins/core/team-manager.go
@@ -1,16 +1,19 @@
package core
import (
- "github.com/eolinker/go-common/pm3"
"net/http"
+
+ "github.com/APIParkLab/APIPark/resources/access"
+
+ "github.com/eolinker/go-common/pm3"
)
func (p *plugin) TeamManagerApi() []pm3.Api {
return []pm3.Api{
- pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/manager/team", []string{"context", "query:id"}, []string{"team"}, p.teamManagerController.GetTeam),
- pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/manager/teams", []string{"context", "query:keyword"}, []string{"teams"}, p.teamManagerController.Search),
- pm3.CreateApiWidthDoc(http.MethodPost, "/api/v1/manager/team", []string{"context", "body"}, []string{"team"}, p.teamManagerController.CreateTeam),
- pm3.CreateApiWidthDoc(http.MethodPut, "/api/v1/manager/team", []string{"context", "query:id", "body"}, []string{"team"}, p.teamManagerController.EditTeam),
- pm3.CreateApiWidthDoc(http.MethodDelete, "/api/v1/manager/team", []string{"context", "query:id"}, []string{"id"}, p.teamManagerController.DeleteTeam),
+ pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/manager/team", []string{"context", "query:id"}, []string{"team"}, p.teamManagerController.GetTeam, access.SystemWorkspaceTeamViewAll, access.TeamTeamTeamView),
+ pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/manager/teams", []string{"context", "query:keyword"}, []string{"teams"}, p.teamManagerController.Search, access.SystemWorkspaceTeamViewAll, access.TeamTeamTeamView),
+ pm3.CreateApiWidthDoc(http.MethodPost, "/api/v1/manager/team", []string{"context", "body"}, []string{"team"}, p.teamManagerController.CreateTeam, access.SystemWorkspaceTeamCreate, access.TeamTeamTeamManager),
+ pm3.CreateApiWidthDoc(http.MethodPut, "/api/v1/manager/team", []string{"context", "query:id", "body"}, []string{"team"}, p.teamManagerController.EditTeam, access.SystemWorkspaceTeamManager, access.TeamTeamTeamManager),
+ pm3.CreateApiWidthDoc(http.MethodDelete, "/api/v1/manager/team", []string{"context", "query:id"}, []string{"id"}, p.teamManagerController.DeleteTeam, access.SystemWorkspaceTeamManager, access.TeamTeamTeamManager),
}
}
diff --git a/plugins/core/upstream.go b/plugins/core/upstream.go
index af77a869..52e1a173 100644
--- a/plugins/core/upstream.go
+++ b/plugins/core/upstream.go
@@ -3,12 +3,13 @@ package core
import (
"net/http"
+ "github.com/APIParkLab/APIPark/resources/access"
"github.com/eolinker/go-common/pm3"
)
func (p *plugin) upstreamApis() []pm3.Api {
return []pm3.Api{
- pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/service/upstream", []string{"context", "query:service"}, []string{"upstream"}, p.upstreamController.Get),
- pm3.CreateApiWidthDoc(http.MethodPut, "/api/v1/service/upstream", []string{"context", "query:service", "body"}, []string{"upstream"}, p.upstreamController.Save),
+ pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/service/upstream", []string{"context", "query:service"}, []string{"upstream"}, p.upstreamController.Get, access.SystemWorkspaceServiceViewAll, access.TeamServiceUpstreamView),
+ pm3.CreateApiWidthDoc(http.MethodPut, "/api/v1/service/upstream", []string{"context", "query:service", "body"}, []string{"upstream"}, p.upstreamController.Save, access.SystemWorkspaceServiceManagerAll, access.TeamServiceUpstreamManager),
}
}
diff --git a/readme/readme-jp.md b/readme/readme-jp.md
index b46c9752..6977a313 100644
--- a/readme/readme-jp.md
+++ b/readme/readme-jp.md
@@ -198,7 +198,7 @@ curl -sSO https://download.apipark.com/install/quick-start.sh; bash quick-start.
# 📕ドキュメント
-詳細なインストールガイド、APIリファレンス、使用説明書については、[APIParkドキュメント](https://docs.apipark.com/docs/install) をご覧ください。
+詳細なインストールガイド、APIリファレンス、使用説明書については、[APIParkドキュメント](https://docs.apipark.com/docs/deploy) をご覧ください。
diff --git a/readme/readme-zh-cn.md b/readme/readme-zh-cn.md
index d1af567f..9384a30a 100644
--- a/readme/readme-zh-cn.md
+++ b/readme/readme-zh-cn.md
@@ -201,7 +201,7 @@ curl -sSO https://download.apipark.com/install/quick-start.sh; bash quick-start.
# 📕文档
-访问 [APIPark文档](https://docs.apipark.com/docs/install) 获取详细的安装指南、API 参考和使用说明。
+访问 [APIPark文档](https://docs.apipark.com/docs/deploy) 获取详细的安装指南、API 参考和使用说明。
diff --git a/readme/readme-zh-tw.md b/readme/readme-zh-tw.md
index 33b2cf35..c6ddc025 100644
--- a/readme/readme-zh-tw.md
+++ b/readme/readme-zh-tw.md
@@ -199,7 +199,7 @@ curl -sSO https://download.apipark.com/install/quick-start.sh; bash quick-start.
# 📕指南
-訪問 [APIPark指南](https://docs.apipark.com/docs/install) 以獲取詳細的安裝指南、API 參考與使用說明。
+訪問 [APIPark指南](https://docs.apipark.com/docs/deploy) 以獲取詳細的安裝指南、API 參考與使用說明。
diff --git a/resources/access/access.go b/resources/access/access.go
index 25c38843..3f3db62f 100644
--- a/resources/access/access.go
+++ b/resources/access/access.go
@@ -3,8 +3,9 @@ package access
import (
_ "embed"
+ yaml "gopkg.in/yaml.v3"
+
"github.com/eolinker/go-common/access"
- "gopkg.in/yaml.v3"
)
type Access = access.Access
@@ -24,22 +25,61 @@ func init() {
access.Add(group, asl)
}
- //defaultRoles := access.Roles()
- //for group, rs := range defaultRoles {
- // p, has := access.GetPermit(group)
- // if !has {
- // continue
- // }
- //
- // for _, r := range rs {
- // for _, pm := range r.Permits {
- // apis, err := p.GetPermits(pm)
- // if err != nil {
- // continue
- // }
- // permit.AddPermitRule(pm, apis...)
- // }
- // }
- //
- //}
}
+
+const (
+ SystemAnalysisRunViewView = "system.analysis.run_view.view"
+ SystemApiPortalApiPortalView = "system.api_portal.api_portal.view"
+ SystemSettingsAccountManager = "system.settings.account.manager"
+ SystemSettingsAccountView = "system.settings.account.view"
+ SystemSettingsAiProviderManager = "system.settings.ai_provider.manager"
+ SystemSettingsAiProviderView = "system.settings.ai_provider.view"
+ SystemSettingsApiGatewayManager = "system.settings.api_gateway.manager"
+ SystemSettingsApiGatewayView = "system.settings.api_gateway.view"
+ SystemSettingsDataSourceManager = "system.settings.data_source.manager"
+ SystemSettingsDataSourceView = "system.settings.data_source.view"
+ SystemSettingsGeneralManager = "system.settings.general.manager"
+ SystemSettingsGeneralView = "system.settings.general.view"
+ SystemSettingsLogConfigurationManager = "system.settings.log_configuration.manager"
+ SystemSettingsLogConfigurationView = "system.settings.log_configuration.view"
+ SystemSettingsRoleView = "system.settings.role.view"
+ SystemSettingsSslCertificateManager = "system.settings.ssl_certificate.manager"
+ SystemSettingsSslCertificateView = "system.settings.ssl_certificate.view"
+ SystemWorkspaceApplicationManagerAll = "system.workspace.application.manager_all"
+ SystemWorkspaceApplicationViewAll = "system.workspace.application.view_all"
+ SystemWorkspaceServiceManagerAll = "system.workspace.service.manager_all"
+ SystemWorkspaceServiceViewAll = "system.workspace.service.view_all"
+ SystemWorkspaceTeamCreate = "system.workspace.team.create"
+ SystemWorkspaceTeamManager = "system.workspace.team.manager"
+ SystemWorkspaceTeamViewAll = "system.workspace.team.view_all"
+)
+
+const (
+ TeamConsumerApplicationManager = "team.consumer.application.manager"
+ TeamConsumerAuthorizationManager = "team.consumer.authorization.manager"
+ TeamConsumerAuthorizationView = "team.consumer.authorization.view"
+ TeamConsumerSubscriptionManagerSubscribed = "team.consumer.subscription.manager_subscribed_services"
+ TeamConsumerSubscriptionSubscribe = "team.consumer.subscription.subscribe"
+ TeamConsumerSubscriptionViewSubscribed = "team.consumer.subscription.view_subscribed_service"
+ TeamServiceApiManager = "team.service.api.manager"
+ TeamServiceApiView = "team.service.api.view"
+ TeamServiceApiDocManager = "team.service.api_doc.manager"
+ TeamServiceApiDocView = "team.service.api_doc.view"
+ TeamServiceReleaseManager = "team.service.release.manager"
+ TeamServiceReleaseView = "team.service.release.view"
+ TeamServiceServiceManager = "team.service.service.manager"
+ TeamServiceServiceIntroManager = "team.service.service_intro.manager"
+ TeamServiceServiceIntroView = "team.service.service_intro.view"
+ TeamServiceSubscriptionManager = "team.service.subscription.manager"
+ TeamServiceSubscriptionView = "team.service.subscription.view"
+ TeamServiceUpstreamManager = "team.service.upstream.manager"
+ TeamServiceUpstreamView = "team.service.upstream.view"
+ TeamTeamConsumerManager = "team.team.consumer.manager"
+ TeamTeamConsumerView = "team.team.consumer.view"
+ TeamTeamMemberManager = "team.team.member.manager"
+ TeamTeamMemberView = "team.team.member.view"
+ TeamTeamServiceManager = "team.team.service.manager"
+ TeamTeamServiceView = "team.team.service.view"
+ TeamTeamTeamManager = "team.team.team.manager"
+ TeamTeamTeamView = "team.team.team.view"
+)
diff --git a/resources/access/access.yaml b/resources/access/access.yaml
index 4008e5e1..69a6daee 100644
--- a/resources/access/access.yaml
+++ b/resources/access/access.yaml
@@ -71,19 +71,6 @@ system:
guest_allow: true
- name: manager
value: 'manager'
- apis:
- - "POST:/api/v1/user/account"
- - "PUT:/api/v1/user/account"
- - "DELETE:/api/v1/user/account"
- - "POST:/api/v1/user/account/enable"
- - "POST:/api/v1/user/account/disable"
- - "POST:/api/v1/user/department"
- - "PUT:/api/v1/user/department"
- - "DELETE:/api/v1/user/department"
- - "POST:/api/v1/user/department/member"
- - "DELETE:/api/v1/user/department/member"
- - "POST:/api/v1/user/department/member/remove"
- - "POST:/api/v1/account/role"
dependents:
- system.settings.account.view
- name: role
@@ -92,11 +79,6 @@ system:
- name: view
guest_allow: true
value: 'view'
- apis:
- - "GET:/api/v1/system/roles"
- - "GET:/api/v1/system/role"
- - "GET:/api/v1/team/roles"
- - "GET:/api/v1/team/role"
- name: api gateway
value: 'api_gateway'
children:
@@ -104,27 +86,18 @@ system:
cname: 查看
value: 'view'
guest_allow: true
- apis:
- - "GET:/api/v1/cluster/nodes"
- name: manager
value: 'manager'
- apis:
- - "PUT:/api/v1/cluster/reset"
- - "POST:/api/v1/cluster/check"
+ dependents:
+ - system.settings.api_gateway.view
- name: ai provider
value: 'ai_provider'
children:
- name: view
value: 'view'
guest_allow: true
- apis:
- - "GET:/api/v1/ai/providers"
- - "GET:/api/v1/ai/provider/config"
- name: manager
value: 'manager'
- apis:
- - "PUT:/api/v1/ai/provider/config"
- - "PUT:/api/v1/ai/provider/default-llm"
dependents:
- system.settings.ai_provider.view
- name: ssl certificate
@@ -134,15 +107,8 @@ system:
- name: view
value: 'view'
guest_allow: true
- apis:
- - "GET:/api/v1/certificates"
- - "GET:/api/v1/certificate"
- name: manager
value: 'manager'
- apis:
- - "POST:/api/v1/certificate"
- - "PUT:/api/v1/certificate"
- - "DELETE:/api/v1/certificate"
dependents:
- system.settings.ssl_certificate.view
- name: data source
@@ -151,13 +117,8 @@ system:
- name: view
value: 'view'
guest_allow: true
- apis:
- - "GET:/api/v1/monitor/config"
- name: manager
value: 'manager'
- apis:
- - "POST:/api/v1/monitor/config"
- - "PUT:/api/v1/monitor/config"
dependents:
- system.settings.data_source.view
- name: log configuration
@@ -166,18 +127,8 @@ system:
- name: view
value: 'view'
guest_allow: true
- apis:
- - "GET:/api/v1/dynamic/{name}/info"
- - "GET:/api/v1/dynamic/{name}/list"
- - "GET:/api/v1/dynamic/{name}/render"
- name: manager
value: 'manager'
- apis:
- - "POST:/api/v1/dynamic/{name}"
- - "PUT:/api/v1/dynamic/{name}/config"
- - "DELETE:/api/v1/dynamic/{name}/batch"
- - "PUT:/api/v1/dynamic/{name}/online"
- - "PUT:/api/v1/dynamic/{name}/offline"
dependents:
- system.settings.log_configuration.view
team:
@@ -190,17 +141,8 @@ team:
- name: view
value: 'view'
guest_allow: true
- apis:
- - "GET:/api/v1/service/routers"
- - "GET:/api/v1/service/router/detail"
- - "GET:/api/v1/service/router/detail/simple"
- - "GET:/api/v1/service/router/define"
- name: manager
value: 'manager'
- apis:
- - "POST:/api/v1/service/router"
- - "PUT:/api/v1/service/router"
- - "DELETE:/api/v1/service/router"
dependents:
- team.service.api.view
- name: api doc
@@ -210,13 +152,8 @@ team:
- name: view
value: 'view'
guest_allow: true
- apis:
- - "GET:/api/v1/service/api_doc"
- name: manager
value: 'manager'
- apis:
- - "PUT:/api/v1/service/api_doc"
- - "POST:/api/v1/service/api_doc/upload"
dependents:
- team.service.api_doc.view
- name: service intro
@@ -236,12 +173,8 @@ team:
- name: view
value: 'view'
guest_allow: true
- apis:
- - "GET:/api/v1/service/upstream"
- name: manager
value: 'manager'
- apis:
- - "PUT:/api/v1/service/upstream"
dependents:
- team.service.upstream.view
- name: release
@@ -250,18 +183,8 @@ team:
- name: view
value: 'view'
guest_allow: true
- apis:
- - "GET:/api/v1/service/releases"
- - "GET:/api/v1/service/release"
- - "GET:/api/v1/service/publishs"
- - "GET:/api/v1/service/publish/check"
- - "GET:/api/v1/service/release/preview"
- - "GET:/api/v1/service/publish/status"
- name: manager
value: 'manager'
- apis:
- - "POST:/api/v1/service/publish/release/do"
- - "DELETE:/api/v1/service/release"
dependents:
- team.service.release.view
- name: subscription review
@@ -270,29 +193,10 @@ team:
- name: view
value: 'view'
guest_allow: true
- apis:
- - "GET:/api/v1/service/approval/subscribes"
- - "GET:/api/v1/service/approval/subscribe"
- - "GET:/api/v1/service/subscribers"
- name: manager
value: 'manager'
- apis:
- - "POST:/api/v1/service/approval/subscribe"
- - "POST:/api/v1/service/subscriber"
- - "DELETE:/api/v1/service/subscriber"
dependents:
- team.service.subscription.view
- - name: service
- value: 'service'
- children:
- - name: manager
- value: 'manager'
- apis:
- - "PUT:/api/v1/service/info"
- - "POST:/api/v1/team/service"
- - "DELETE:/api/v1/team/service"
- dependents:
- - team.service.service.manager
- name: consumer
value: 'consumer'
children:
@@ -305,38 +209,20 @@ team:
- name: view subscribed services
value: 'view_subscribed_service'
guest_allow: true
- apis:
- - "GET:/api/v1/application/subscription"
- name: manager subscribed services
value: 'manager_subscribed_services'
- apis:
- - "POST:/api/v1/catalogue/service/subscribe"
- - "POST:/api/v1/application/subscription/cancel"
- - "POST:/api/v1/application/subscription/cancel_apply"
+ dependents:
+ - team.consumer.subscription.manager_subscribed_services
- name: authorization
value: 'authorization'
children:
- name: view
value: 'view'
guest_allow: true
- apis:
- - "GET:/api/v1/app/authorization"
- - "GET:/api/v1/app/authorizations"
- - "GET:/api/v1/app/authorization/details"
- name: manager
value: 'manager'
- apis:
- - "POST:/api/v1/app/authorization"
- - "PUT:/api/v1/app/authorization"
- - "DELETE:/api/v1/app/authorization"
- - name: consumer
- value: 'application'
- children:
- - name: manager
- value: 'manager'
- apis:
- - "PUT:/api/v1/app/info"
- - "POST:/api/v1/team/app"
+ dependents:
+ - team.consumer.authorization.view
- name: team
value: 'team'
children:
@@ -376,7 +262,6 @@ team:
- name: view
value: 'view'
guest_allow: true
- apis:
- name: manager
value: 'manager'
apis:
diff --git a/resources/access/role.yaml b/resources/access/role.yaml
index 19772f90..8dcd8e1a 100644
--- a/resources/access/role.yaml
+++ b/resources/access/role.yaml
@@ -62,7 +62,6 @@ team:
- name: team admin
value: team_admin
permits:
- - team.consumer.application.manager
- team.consumer.authorization.manager
- team.consumer.authorization.view
- team.consumer.subscription.manager_subscribed_services
@@ -74,7 +73,6 @@ team:
- team.service.api_doc.view
- team.service.release.manager
- team.service.release.view
- - team.service.service.manager
- team.service.service_intro.manager
- team.service.service_intro.view
- team.service.subscription.manager
@@ -99,7 +97,6 @@ team:
- team.service.api_doc.view
- team.service.release.manager
- team.service.release.view
- - team.service.service.manager
- team.service.service_intro.manager
- team.service.service_intro.view
- team.service.subscription.manager
@@ -134,7 +131,6 @@ team:
- name: consumer admin
value: consumer_admin
permits:
- - team.consumer.application.manager
- team.consumer.authorization.manager
- team.consumer.authorization.view
- team.consumer.subscription.manager_subscribed_services
diff --git a/resources/locale/locale.go b/resources/locale/locale.go
index 7b75955b..bf31dd50 100644
--- a/resources/locale/locale.go
+++ b/resources/locale/locale.go
@@ -5,18 +5,15 @@ import (
"encoding/json"
"strings"
- "github.com/eolinker/eosc"
+ "github.com/eolinker/go-common/pm3"
)
var (
//go:embed i18n/*
- i18nDirs embed.FS
- i18nData eosc.Untyped[string, map[string]string]
- defaultI18n = "zh-CN"
+ i18nDirs embed.FS
)
func init() {
- i18nData = eosc.BuildUntyped[string, map[string]string]()
files, err := i18nDirs.ReadDir("i18n")
if err != nil {
panic(err)
@@ -34,19 +31,6 @@ func init() {
panic(err)
}
key := strings.TrimSuffix(f.Name(), ".json")
- i18nData.Set(key, tmp)
+ pm3.I18nRegister(key, tmp)
}
}
-
-func Get(i18n string) map[string]string {
- result, has := i18nData.Get(i18n)
- if has {
- return result
- }
-
- result, has = i18nData.Get(defaultI18n)
- if !has {
- return make(map[string]string)
- }
- return result
-}
diff --git a/scripts/docker-compose.yml b/scripts/docker-compose.yml
new file mode 100644
index 00000000..f768ef68
--- /dev/null
+++ b/scripts/docker-compose.yml
@@ -0,0 +1,95 @@
+version: '3'
+services:
+ apipark-mysql:
+ image: mysql:8.0.37
+ privileged: true
+ restart: always
+ container_name: apipark-mysql
+ hostname: apipark-mysql
+ command:
+ - "--character-set-server=utf8mb4"
+ - "--collation-server=utf8mb4_unicode_ci"
+ ports:
+ - "33306:3306"
+ environment:
+ - MYSQL_ROOT_PASSWORD=123456
+ - MYSQL_DATABASE=apipark
+ volumes:
+ - /var/lib/apipark/mysql:/var/lib/mysql
+ networks:
+ - apipark
+ apipark:
+ image: apipark/apipark:v1.2.0-beta
+ container_name: apipark
+ privileged: true
+ restart: always
+ networks:
+ - apipark
+ ports:
+ - "18288:8288"
+ depends_on:
+ - apipark-mysql
+ environment:
+ - MYSQL_USER_NAME=root
+ - MYSQL_PWD=123456
+ - MYSQL_IP=apipark-mysql
+ - MYSQL_PORT=3306 #mysql端口
+ - MYSQL_DB="apipark"
+ - ERROR_DIR=work/logs # 日志放置目录
+ - ERROR_FILE_NAME=error.log # 错误日志文件名
+ - ERROR_LOG_LEVEL=info # 错误日志等级,可选:panic,fatal,error,warning,info,debug,trace 不填或者非法则为info
+ - ERROR_EXPIRE=7d # 错误日志过期时间,默认单位为天,d|天,h|小时, 不合法配置默认为7d
+ - ERROR_PERIOD=day # 错误日志切割周期,仅支持day、hour
+ - REDIS_ADDR=apipark-redis:6379 #Redis集群地址 多个用,隔开
+ - REDIS_PWD=123456 # Redis密码
+ - ADMIN_PASSWORD=12345678
+ influxdb2:
+ image: influxdb:2.6
+ privileged: true
+ restart: always
+ container_name: influxdb2
+ hostname: influxdb2
+ ports:
+ - "8086:8086"
+ volumes:
+ - /var/lib/apipark/influxdb2:/var/lib/influxdb2
+ networks:
+ - apipark
+ apipark-redis:
+ container_name: apipark-redis
+ image: redis:7.2.4
+ hostname: apipark-redis
+ privileged: true
+ restart: always
+ ports:
+ - "6379:6379"
+ command:
+ - bash
+ - -c
+ - "redis-server --protected-mode yes --logfile redis.log --appendonly no --port 6379 --requirepass 123456"
+ networks:
+ - apipark
+ apipark-apinto:
+ image: eolinker/apinto-gateway
+ container_name: apipark-apinto
+ privileged: true
+ restart: always
+ command:
+ - ./start.sh
+ ports:
+ - "8099:8099"
+ - "9400:9400"
+ - "9401:9401"
+ volumes:
+ - /var/lib/apipark/apinto/data:/var/lib/apinto
+ - /var/lib/apipark/apinto/log:/var/log/apinto
+ - ${PWD}/config.yml:/etc/apinto/config.yml
+ networks:
+ - apipark
+networks:
+ apipark:
+ driver: bridge
+ ipam:
+ driver: default
+ config:
+ - subnet: 172.100.0.0/24
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