From acd237530cc97fd19aff825e29f4d0a0c64f4d5c Mon Sep 17 00:00:00 2001 From: ssongliu Date: Mon, 13 Jun 2022 18:25:48 +0800 Subject: [PATCH] =?UTF-8?q?fix(image):=20=E5=A2=9E=E5=8A=A0=E9=95=9C?= =?UTF-8?q?=E5=83=8F=E4=BB=93=E5=BA=93=E7=AE=A1=E7=90=86=E5=91=98=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E8=A7=92=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- migrate/v1/migrations.go | 32 ++++++++++++++++++++++++++++++- web/kubepi/src/i18n/lang/en-US.js | 21 +++++++++++--------- web/kubepi/src/i18n/lang/zh-CN.js | 7 +++++-- 3 files changed, 48 insertions(+), 12 deletions(-) diff --git a/migrate/v1/migrations.go b/migrate/v1/migrations.go index 88d32fda..f8d15290 100644 --- a/migrate/v1/migrations.go +++ b/migrate/v1/migrations.go @@ -1,6 +1,8 @@ package v1 import ( + "time" + v1 "github.com/KubeOperator/kubepi/internal/model/v1" v1Role "github.com/KubeOperator/kubepi/internal/model/v1/role" v1User "github.com/KubeOperator/kubepi/internal/model/v1/user" @@ -8,11 +10,11 @@ import ( "github.com/asdine/storm/v3" "github.com/google/uuid" "golang.org/x/crypto/bcrypt" - "time" ) var Migrations = []migrations.Migration{ CreateAdministrator, + AddRoleManagerRepo, } // 创建默认系统角色: Admin |Manage Cluster| Manage User|Read only|Common User | Manage Chart @@ -142,3 +144,31 @@ var CreateAdministrator = migrations.Migration{ return nil }, } + +var AddRoleManagerRepo = migrations.Migration{ + Version: 2, + Message: "Add role repo manager", + Handler: func(db storm.Node) error { + roleManageRepo := v1Role.Role{ + BaseModel: v1.BaseModel{ + ApiVersion: "v1", + Kind: "Role", + BuiltIn: true, + CreateAt: time.Now(), + UpdateAt: time.Now(), + }, + Metadata: v1.Metadata{ + Name: "Manage Image Registries", + Description: "i18n_user_manage_repo", + UUID: uuid.New().String(), + }, + Rules: []v1Role.PolicyRule{ + { + Resource: []string{"imagerepos"}, + Verbs: []string{"*"}, + }, + }, + } + return db.Save(&roleManageRepo) + }, +} diff --git a/web/kubepi/src/i18n/lang/en-US.js b/web/kubepi/src/i18n/lang/en-US.js index 131cc0da..f6780577 100644 --- a/web/kubepi/src/i18n/lang/en-US.js +++ b/web/kubepi/src/i18n/lang/en-US.js @@ -171,7 +171,7 @@ const message = { template: "template", base_on_exists_role: "base on exists role", permission: "permission", - permission_setting: "permission setting", + permission_setting: "Permission setting", password: "password", confirm_password: "confirm password", old_password: "old password", @@ -209,7 +209,7 @@ const message = { size_limit: "Number of search pages", }, system: { - system_log: "Audits", + system_log: "Auditing Log", operation_log: "Operation Logs", operator: "Operator", operation: "Operation", @@ -221,7 +221,7 @@ const message = { city: "Login city", }, image_repos: { - list: "Mirror Warehouse", + list: "Image Registries", name: "Name", endpoint: "Address", downloadUrl: "Download URL", @@ -244,6 +244,7 @@ const description = { i18n_user_administrator: "Super administrator, with permissions for all objects.", i18n_user_manage_cluster: "The Cluster Administrator has all the permissions of the cluster object.", i18n_user_manage_rbac: "Role and user administrators have all the permissions of the user objects.", + i18n_user_manage_repo: "Image repostries administrators have all the permissions of the image repostries objects.", i18n_user_manage_readonly: "Read only user with access to all objects only,", i18n_user_common_user: "Ordinary users only have access to cluster objects", i18n_user_manage_chart: "Chart warehouse administrator, has all rights to the Chart warehouse", @@ -297,12 +298,14 @@ const system_logs = { post: "create", put: "update", delete: "delete", - clusters: "cluster", - users: "user", - clusters_members: "cluster members", - clusters_clusterroles: "cluster roles", - clusters_repos: "cluster repos", - imagerepos: "image repos", + clusters: "Clusters", + users: "User", + roles: "Role", + systems: "Auditing Log", + clusters_members: "Cluster Member", + clusters_clusterroles: "Cluster Role", + clusters_repos: "Cluster Repos", + imagerepos: "Image Registries", ldap: "LDAP", } diff --git a/web/kubepi/src/i18n/lang/zh-CN.js b/web/kubepi/src/i18n/lang/zh-CN.js index df7173b6..0f98edbd 100644 --- a/web/kubepi/src/i18n/lang/zh-CN.js +++ b/web/kubepi/src/i18n/lang/zh-CN.js @@ -244,7 +244,7 @@ const apiObjects = { users: "用户", roles: "角色", clusters: "集群", - systems: "系统日志", + systems: "日志审计", } const apiVerbs = { @@ -260,8 +260,10 @@ const system_logs = { post: "创建", put: "修改", delete: "删除", - clusters: "集群", + clusters: "集群列表", users: "用户", + roles: "角色", + systems: "日志审计", clusters_members: "集群成员", clusters_clusterroles: "集群角色", clusters_repos: "集群仓库", @@ -274,6 +276,7 @@ const description = { i18n_user_administrator: "超级管理员,拥有所有对象的权限", i18n_user_manage_cluster: "集群管理员,拥有集群对象的所有权限", i18n_user_manage_rbac: "角色与用户管理员,拥有用户管理对象的所有权限", + i18n_user_manage_repo: "镜像仓库管理员,拥有镜像仓库对象的所有权限", i18n_user_manage_readonly: "只读用户,只拥有所有对象的访问权限", i18n_user_common_user: "普通用户,只拥有集群对象访问权限", i18n_user_manage_chart: "Chart仓库管理员, 拥有对Chart仓库的所有权限",