Merge branch 'feature/v1.2' into 'main'

Feature/v1.2

See merge request apipark/APIPark!68
This commit is contained in:
杨梦洁
2024-10-29 17:46:36 +08:00
17 changed files with 127 additions and 129 deletions
-1
View File
@@ -3,4 +3,3 @@
/config.yml
/build/
/apipark
/aoplatform
@@ -319,7 +319,7 @@
"Ka46b9b24": "Data Source Type",
"Kbb0cdcd0": "Data Source Address",
"Kd9dfb884": "Organization",
"K3e770a75": "Authentication Token",
"K3e770a75": "Credentials Token",
"K8ef69ee2": "Key",
"Kba3507d6": "Upload Key",
"K93ac0f23": "Key file suffix is usually .key",
@@ -365,7 +365,7 @@
"Kcef64f4d": "Default AI Provider",
"Kcab588a9": "No AI model provider set,",
"Kb9b56111": "Set Now",
"Kcf756b7a": "API Call Prefix",
"Kcf756b7a": "API Request Prefix",
"K13edc043": "As a prefix for all APIs in the service, e.g., host/{service_name}/{api_path}, cannot be modified once saved.",
"Kf52a584d": "Service Category",
"K72b21be5": "Set the category in which the service will be displayed in the service marketplace",
@@ -391,8 +391,8 @@
"K813e1c0a": "Team Name",
"K692f5aa6": "Team ID",
"K5de0bc2": "Team ID can be used to retrieve the team, cannot be modified once saved.",
"Ka63dd985": "Team Leader",
"Ka6bcd272": "The leader has management authority over the team, services, and members within the team",
"Ka63dd985": "Team Administrator",
"Ka6bcd272": "The Administrator has management authority over the team, services, and members within the team",
"Ka2012bdd": "Delete Team",
"Kbde1f3d": "Service data must be cleared before deletion",
"K395acc14": "Remove",
@@ -463,7 +463,7 @@
"Kd59290a2": "Search Category or Tag",
"K6b75bdbc": "No API Data",
"K4b15d6f5": "Application Reason",
"Kb71b5a13": "Authentication Type",
"Kb71b5a13": "Credentials Type",
"K4d1465ee": "ISS",
"K5dcd7ed8": "Signature Algorithm",
"K5b0eedd3": "Secret",
@@ -475,10 +475,10 @@
"K31418470": "SK",
"Kbfeb5297": "API Key",
"K1a78e6f0": "Expiration Time",
"Ke64e43a": "Hide Authentication Info",
"K217cb125": "Authentication Details",
"K2bb63eca": "Add Authentication",
"Kd74d69b7": "Edit Authentication",
"Ke64e43a": "Hide Credentials Info",
"K217cb125": "Credentials Details",
"K2bb63eca": "Add Credentials",
"Kd74d69b7": "Edit Credentials",
"K9cbe1e0": "Modify",
"Kb6e9328f": "Authorization",
"Kd23d1716": "Add Authorization",
@@ -676,5 +676,7 @@
"K6e32a344": "订阅服务数量",
"Ka701316": "鉴权数量",
"K9eaa2eb6": "列表",
"Kfaec39e9": "块"
"Kfaec39e9": "块",
"Kc3b7bfa8": "暂无消费者描述",
"K3a6f905d": "输入名称、ID 查找消费者"
}
+1
View File
@@ -1,5 +1,6 @@
package main
// init module
import (
_ "github.com/APIParkLab/APIPark/frontend"
_ "github.com/APIParkLab/APIPark/gateway/apinto"
-1
View File
@@ -9,5 +9,4 @@ import (
)
func doCheck() {
}
+14 -14
View File
@@ -6,6 +6,11 @@ import (
"bytes"
"encoding/csv"
"fmt"
"os"
"sort"
"strings"
"time"
_ "github.com/APIParkLab/APIPark/resources/access"
_ "github.com/APIParkLab/APIPark/resources/permit"
_ "github.com/APIParkLab/APIPark/resources/plugin"
@@ -14,19 +19,15 @@ import (
"github.com/eolinker/go-common/permit"
"github.com/eolinker/go-common/pm3"
"github.com/eolinker/go-common/utils"
"os"
"sort"
"strings"
"time"
)
const unsetValue = "-"
func doCheck() {
accessConf, unset := loadAccess()
drivers := pm3.List()
newAccess := 0
for _, p := range drivers {
if ac, ok := p.(pm3.AccessConfig); ok {
@@ -39,9 +40,9 @@ func doCheck() {
}
}
}
}
}
for asKey := range permit.All() {
key := strings.ToLower(asKey)
@@ -53,12 +54,11 @@ func doCheck() {
if newAccess > 0 || unset > 0 {
f := accessFile()
fmt.Printf("%d access need set, see : %s and %s", newAccess+unset, saveTemplate(accessConf, f), saveCsv(accessConf, f))
}
os.Exit(0)
}
func accessFile() string {
if version == "" {
return time.Now().Format("20060102-150405")
}
@@ -84,7 +84,7 @@ func saveCsv(as map[string]*Access, key string) string {
err = os.WriteFile(filePath, buf.Bytes(), 0666)
if err != nil {
log.Fatal(err)
}
return filePath
}
@@ -111,9 +111,9 @@ func (ls AccessListSort) Swap(i, j int) {
func saveTemplate(as map[string]*Access, key string) string {
out := make(map[string][]access.Access)
for _, a := range as {
out[a.Group] = append(out[a.Group], access.Access{
Name: a.Name,
CName: a.Cname,
@@ -130,7 +130,7 @@ func saveTemplate(as map[string]*Access, key string) string {
err = os.WriteFile(filePath, buf.Bytes(), 0666)
if err != nil {
log.Fatal(err)
}
return filePath
}
+3 -3
View File
@@ -3,13 +3,14 @@ package main
import (
"flag"
"fmt"
"net"
"net/http"
"github.com/eolinker/eosc/log"
"github.com/eolinker/go-common/autowire"
"github.com/eolinker/go-common/cftool"
"github.com/eolinker/go-common/permit"
"github.com/eolinker/go-common/server"
"net"
"net/http"
)
var (
@@ -54,7 +55,6 @@ func main() {
for access, paths := range srv.Permits() {
permit.AddPermitRule(access, paths...)
}
err = http.Serve(ln, srv)
if err != nil {
log.Fatal(err)
+5 -10
View File
@@ -3,7 +3,7 @@ package permit_middleware
import (
"net/http"
"reflect"
permit_identity "github.com/APIParkLab/APIPark/middleware/permit/identity"
"github.com/eolinker/eosc/log"
"github.com/eolinker/go-common/autowire"
@@ -42,11 +42,11 @@ func (p *PermitMiddleware) Sort() int {
func (p *PermitMiddleware) Check(method string, path string) (bool, []gin.HandlerFunc) {
// 当前路径是否有配置权限
accessRules, has := permit.GetPathRule(method, path)
if !has || len(accessRules) == 0 {
return false, nil
}
return true, []gin.HandlerFunc{
func(ginCtx *gin.Context) {
userId := utils.UserId(ginCtx)
@@ -56,19 +56,14 @@ func (p *PermitMiddleware) Check(method string, path string) (bool, []gin.Handle
ginCtx.Abort()
return
}
//if userId == "admin" {
// // 超级管理员不校验
// return
//}
for _, group := range checkSort {
accessList, has := accessRules[group]
if !has {
// 当前分组没有配置权限
continue
}
domainHandler, has := permit.SelectDomain(group)
if !has {
// 当前分组没有配置身份handler
+1
View File
@@ -9,6 +9,7 @@ type Kind int
func (k *Kind) UnmarshalJSON(bytes []byte) error {
str := ""
err := json.Unmarshal(bytes, &str)
if err != nil {
return err
+4 -11
View File
@@ -348,20 +348,13 @@ func (i *imlProviderModule) UpdateProviderDefaultLLM(ctx context.Context, id str
})
}
func (i *imlProviderModule) getAiProviders(ctx context.Context, clusterId string) ([]*gateway.DynamicRelease, error) {
list, err := i.providerService.List(ctx, clusterId)
if err != nil {
return nil, err
}
func (i *imlProviderModule) getAiProviders(ctx context.Context) ([]*gateway.DynamicRelease, error) {
list, err := i.providerService.List(ctx)
if err != nil {
return nil, err
}
providers := make([]*gateway.DynamicRelease, 0, len(list))
for _, p := range list {
if !p.Status {
// 关闭
continue
}
cfg := make(map[string]interface{})
err = json.Unmarshal([]byte(p.Config), &cfg)
if err != nil {
@@ -384,7 +377,7 @@ func (i *imlProviderModule) getAiProviders(ctx context.Context, clusterId string
return providers, nil
}
func (i *imlProviderModule) initGateway(ctx context.Context, clusterId string, clientDriver gateway.IClientDriver) error {
providers, err := i.getAiProviders(ctx, clusterId)
providers, err := i.getAiProviders(ctx)
if err != nil {
return err
}
@@ -401,7 +394,7 @@ func (i *imlProviderModule) initGateway(ctx context.Context, clusterId string, c
if err != nil {
return err
}
err = client.Online(ctx, providers...)
err = client.Online(ctx, p)
if err != nil {
return err
}
+5 -6
View File
@@ -145,7 +145,7 @@ system:
- "DELETE:/api/v1/certificate"
dependents:
- system.settings.ssl_certificate.view
- name: Data Source
- name: data source
value: 'data_source'
children:
- name: view
@@ -264,7 +264,7 @@ team:
- "DELETE:/api/v1/service/release"
dependents:
- team.service.release.view
- name: subscription management
- name: subscription review
value: 'subscription'
children:
- name: view
@@ -296,13 +296,12 @@ team:
- name: consumer
value: 'consumer'
children:
- name: subscription Service
- name: subscription service
cname: 订阅服务
value: 'subscription'
children:
- name: subscribe
- name: allow subscribe service
value: 'subscribe'
- name: view subscribed services
value: 'view_subscribed_service'
guest_allow: true
@@ -371,7 +370,7 @@ team:
value: 'manager'
dependents:
- team.team.member.view
- name: team
- name: team settings
value: 'team'
children:
- name: view
+22 -20
View File
@@ -1,44 +1,46 @@
{
"account": "Account",
"ai provider": "AI Provider",
"api market": "API Portal",
"analysis": "Analysis Report",
"api": "API",
"api doc": "API Documentation",
"application": "Application",
"application admin": "Application Administrator",
"application developer": "Application Developer",
"authorization": "Authorization",
"cluster": "Cluster",
"dashboard": "Dashboard",
"api gateway": "API Gateway",
"api portal": "API Portal",
"authorization": "Access Authorization",
"consumer": "Consumer",
"consumer admin": "Consumer Admin",
"consumer developer": "Consumer Developer",
"create": "Create",
"data source": "Data Source",
"devops": "DevOps",
"devops admin": "DevOps Administrator",
"devops admin": "DevOps Admin",
"general": "General Settings",
"general member": "General Member",
"guest": "Guest",
"log configuration": "Log Configuration",
"manager": "Manager",
"manager all consumer": "Manage All Consumers",
"manager subscribed services": "Manage Subscribed Services",
"member": "Member",
"organization": "Organization Management",
"release": "Release",
"role": "Role",
"router": "Router",
"run view": "Run View",
"service": "Service",
"service admin": "Service Administrator",
"service classification": "Service Directory",
"service admin": "Service Admin",
"service developer": "Service Developer",
"service intro": "Service Documentation",
"ssl certificate": "SSL Certificate",
"subscription management": "Subscription Management",
"allow subscribe service": "Allow Subscribe Service",
"subscription review": "Subscription Review",
"subscription service": "Subscription Service",
"super admin": "Super Administrator",
"super admin": "Super Admin",
"system settings": "System Settings",
"team": "Team",
"team admin": "Team Administrator",
"team settings": "Team Settings",
"team admin": "Team Admin",
"upstream": "Upstream",
"view": "View",
"view all application": "View All Applications",
"view all consumer": "View All Consumers",
"view all service": "View All Services",
"view all team": "View All Teams",
"view system role": "View System Roles",
"view team role": "View Team Roles",
"view subscribed services": "View Subscribed Services",
"workspace": "Workspace"
}
+19 -17
View File
@@ -1,44 +1,46 @@
{
"account": "アカウント",
"ai provider": "AIプロバイダー",
"api market": "APIマーケット",
"analysis": "分析レポート",
"api": "API",
"api doc": "APIドキュメント",
"application": "アプリケーション",
"application admin": "アプリケーション管理者",
"application developer": "アプリケーション開発者",
"authorization": "認証",
"cluster": "クラスター",
"dashboard": "ダッシュボード",
"api gateway": "APIゲートウェイ",
"api portal": "APIポータル",
"authorization": "アクセス許可",
"consumer": "消費者",
"consumer admin": "消費者管理者",
"consumer developer": "消費者開発者",
"create": "作成",
"data source": "データソース",
"devops": "DevOps",
"devops admin": "DevOps管理者",
"general": "一般設定",
"general member": "一般メンバー",
"guest": "ゲスト",
"log configuration": "ログ設定",
"manager": "管理者",
"manager all consumer": "すべての消費者を管理",
"manager subscribed services": "購読したサービスを管理",
"member": "メンバー",
"organization": "組織管理",
"release": "リリース",
"role": "役割",
"router": "ルーター",
"run view": "実行ビュー",
"service": "サービス",
"service admin": "サービス管理者",
"service classification": "サービスディレクトリ",
"service developer": "サービス開発者",
"service intro": "サービスドキュメント",
"ssl certificate": "SSL証明書",
"subscription management": "サブスクリプション管理",
"subscription service": "サブスクリプションサービス",
"allow subscribe service": "サービスの購読を許可",
"subscription review": "購読レビュー",
"subscription service": "購読サービス",
"super admin": "スーパ管理者",
"system settings": "システム設定",
"team": "チーム",
"team settings": "チーム設定",
"team admin": "チーム管理者",
"upstream": "アップストリーム",
"view": "表示",
"view all application": "すべてのアプリケーションを表示",
"view all consumer": "すべての消費者を表示",
"view all service": "すべてのサービスを表示",
"view all team": "すべてのチームを表示",
"view system role": "システム役割を表示",
"view team role": "チーム役割を表示",
"view subscribed services": "購読したサービスを表示",
"workspace": "ワークスペース"
}
+20 -18
View File
@@ -1,44 +1,46 @@
{
"ai provider": "AI供应商",
"api market": "API门户",
"account": "账号",
"ai provider": "AI模型供应商",
"analysis": "分析报告",
"api": "API",
"api doc": "API文档",
"application": "应用",
"application admin": "应用管理员",
"application developer": "应用开发者",
"authorization": "鉴权",
"cluster": "集群",
"dashboard": "仪表盘",
"api gateway": "API网关",
"api portal": "API门户",
"authorization": "访问授权",
"consumer": "消费者",
"consumer admin": "消费者管理员",
"consumer developer": "消费者开发者",
"create": "创建",
"data source": "数据源",
"devops": "运维",
"devops admin": "运维管理员",
"general": "常规设置",
"general member": "普通成员",
"guest": "访客",
"log configuration": "日志配置",
"manager": "管理",
"manager all consumer": "管理所有消费者",
"manager subscribed services": "管理已订阅的服务",
"member": "成员",
"organization": "组织管理",
"release": "发布",
"role": "角色",
"router": "路由",
"run view": "运行视图",
"service": "服务",
"service admin": "服务管理员",
"service classification": "服务目录",
"service developer": "服务开发者",
"service intro": "服务文档",
"ssl certificate": "SSL证书",
"subscription management": "订阅方管理",
"allow subscribe service": "允许订阅服务",
"subscription review": "订阅审核",
"subscription service": "订阅服务",
"super admin": "超级管理员",
"system settings": "系统设置",
"team": "团队",
"team settings": "团队设置",
"team admin": "团队管理员",
"upstream": "上游",
"view": "查看",
"view all application": "查看所有应用",
"view all consumer": "查看所有消费者",
"view all service": "查看所有服务",
"view all team": "查看所有团队",
"view system role": "查看系统角色",
"view team role": "查看团队角色",
"view subscribed services": "查看已经订阅的服务",
"workspace": "工作空间"
}
}
+19 -17
View File
@@ -1,44 +1,46 @@
{
"ai provider": "AI供應商",
"api market": "API市場",
"account": "帳號",
"ai provider": "AI模型供應商",
"analysis": "分析報告",
"api": "API",
"api doc": "API文檔",
"application": "應用",
"application admin": "應用管理員",
"application developer": "應用開發者",
"authorization": "授權",
"cluster": "集群",
"dashboard": "儀表盤",
"api gateway": "API網關",
"api portal": "API門戶",
"authorization": "訪問授權",
"consumer": "消費者",
"consumer admin": "消費者管理員",
"consumer developer": "消費者開發者",
"create": "創建",
"data source": "數據源",
"devops": "運維",
"devops admin": "運維管理員",
"general": "常規設置",
"general member": "普通成員",
"guest": "訪客",
"log configuration": "日誌配置",
"manager": "管理",
"manager all consumer": "管理所有消費者",
"manager subscribed services": "管理已訂閱的服務",
"member": "成員",
"organization": "組織管理",
"release": "發布",
"role": "角色",
"router": "路由",
"run view": "運行視圖",
"service": "服務",
"service admin": "服務管理員",
"service classification": "服務目錄",
"service developer": "服務開發者",
"service intro": "服務文檔",
"ssl certificate": "SSL證書",
"subscription management": "訂閱方管理",
"allow subscribe service": "允許訂閱服務",
"subscription review": "訂閱審核",
"subscription service": "訂閱服務",
"super admin": "超級管理員",
"system settings": "系統設置",
"team": "團隊",
"team settings": "團隊設置",
"team admin": "團隊管理員",
"upstream": "上游",
"view": "查看",
"view all application": "查看所有應用",
"view all consumer": "查看所有消費者",
"view all service": "查看所有服務",
"view all team": "查看所有團隊",
"view system role": "查看系統角色",
"view team role": "查看團隊角色",
"view subscribed services": "查看已訂閱的服務",
"workspace": "工作空間"
}
+1 -1
View File
@@ -1,4 +1,4 @@
# 名称:apinto通用镜像
# 名称:apipark通用镜像
# 创建时间:2022-10-25
FROM centos:7.9.2009
MAINTAINER liujian
Executable → Regular
+1
View File
@@ -25,6 +25,7 @@ cd "./eosc" && git pull
# =========================================================================
echo "更新 aoaccount"
cd "${BASEPATH}/"
if [ ! -d "./aoaccount" ]; then
git clone http://gitlab.eolink.com/apinto/aoaccount.git
fi