mirror of
https://github.com/1Panel-dev/KubePi.git
synced 2025-09-27 03:36:04 +08:00
fix(image): 增加镜像仓库管理员默认角色
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
package v1
|
package v1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
v1 "github.com/KubeOperator/kubepi/internal/model/v1"
|
v1 "github.com/KubeOperator/kubepi/internal/model/v1"
|
||||||
v1Role "github.com/KubeOperator/kubepi/internal/model/v1/role"
|
v1Role "github.com/KubeOperator/kubepi/internal/model/v1/role"
|
||||||
v1User "github.com/KubeOperator/kubepi/internal/model/v1/user"
|
v1User "github.com/KubeOperator/kubepi/internal/model/v1/user"
|
||||||
@@ -8,11 +10,11 @@ import (
|
|||||||
"github.com/asdine/storm/v3"
|
"github.com/asdine/storm/v3"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"golang.org/x/crypto/bcrypt"
|
"golang.org/x/crypto/bcrypt"
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var Migrations = []migrations.Migration{
|
var Migrations = []migrations.Migration{
|
||||||
CreateAdministrator,
|
CreateAdministrator,
|
||||||
|
AddRoleManagerRepo,
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建默认系统角色: Admin |Manage Cluster| Manage User|Read only|Common User | Manage Chart
|
// 创建默认系统角色: Admin |Manage Cluster| Manage User|Read only|Common User | Manage Chart
|
||||||
@@ -142,3 +144,31 @@ var CreateAdministrator = migrations.Migration{
|
|||||||
return nil
|
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)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
@@ -171,7 +171,7 @@ const message = {
|
|||||||
template: "template",
|
template: "template",
|
||||||
base_on_exists_role: "base on exists role",
|
base_on_exists_role: "base on exists role",
|
||||||
permission: "permission",
|
permission: "permission",
|
||||||
permission_setting: "permission setting",
|
permission_setting: "Permission setting",
|
||||||
password: "password",
|
password: "password",
|
||||||
confirm_password: "confirm password",
|
confirm_password: "confirm password",
|
||||||
old_password: "old password",
|
old_password: "old password",
|
||||||
@@ -209,7 +209,7 @@ const message = {
|
|||||||
size_limit: "Number of search pages",
|
size_limit: "Number of search pages",
|
||||||
},
|
},
|
||||||
system: {
|
system: {
|
||||||
system_log: "Audits",
|
system_log: "Auditing Log",
|
||||||
operation_log: "Operation Logs",
|
operation_log: "Operation Logs",
|
||||||
operator: "Operator",
|
operator: "Operator",
|
||||||
operation: "Operation",
|
operation: "Operation",
|
||||||
@@ -221,7 +221,7 @@ const message = {
|
|||||||
city: "Login city",
|
city: "Login city",
|
||||||
},
|
},
|
||||||
image_repos: {
|
image_repos: {
|
||||||
list: "Mirror Warehouse",
|
list: "Image Registries",
|
||||||
name: "Name",
|
name: "Name",
|
||||||
endpoint: "Address",
|
endpoint: "Address",
|
||||||
downloadUrl: "Download URL",
|
downloadUrl: "Download URL",
|
||||||
@@ -244,6 +244,7 @@ const description = {
|
|||||||
i18n_user_administrator: "Super administrator, with permissions for all objects.",
|
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_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_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_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_common_user: "Ordinary users only have access to cluster objects",
|
||||||
i18n_user_manage_chart: "Chart warehouse administrator, has all rights to the Chart warehouse",
|
i18n_user_manage_chart: "Chart warehouse administrator, has all rights to the Chart warehouse",
|
||||||
@@ -297,12 +298,14 @@ const system_logs = {
|
|||||||
post: "create",
|
post: "create",
|
||||||
put: "update",
|
put: "update",
|
||||||
delete: "delete",
|
delete: "delete",
|
||||||
clusters: "cluster",
|
clusters: "Clusters",
|
||||||
users: "user",
|
users: "User",
|
||||||
clusters_members: "cluster members",
|
roles: "Role",
|
||||||
clusters_clusterroles: "cluster roles",
|
systems: "Auditing Log",
|
||||||
clusters_repos: "cluster repos",
|
clusters_members: "Cluster Member",
|
||||||
imagerepos: "image repos",
|
clusters_clusterroles: "Cluster Role",
|
||||||
|
clusters_repos: "Cluster Repos",
|
||||||
|
imagerepos: "Image Registries",
|
||||||
ldap: "LDAP",
|
ldap: "LDAP",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -244,7 +244,7 @@ const apiObjects = {
|
|||||||
users: "用户",
|
users: "用户",
|
||||||
roles: "角色",
|
roles: "角色",
|
||||||
clusters: "集群",
|
clusters: "集群",
|
||||||
systems: "系统日志",
|
systems: "日志审计",
|
||||||
}
|
}
|
||||||
|
|
||||||
const apiVerbs = {
|
const apiVerbs = {
|
||||||
@@ -260,8 +260,10 @@ const system_logs = {
|
|||||||
post: "创建",
|
post: "创建",
|
||||||
put: "修改",
|
put: "修改",
|
||||||
delete: "删除",
|
delete: "删除",
|
||||||
clusters: "集群",
|
clusters: "集群列表",
|
||||||
users: "用户",
|
users: "用户",
|
||||||
|
roles: "角色",
|
||||||
|
systems: "日志审计",
|
||||||
clusters_members: "集群成员",
|
clusters_members: "集群成员",
|
||||||
clusters_clusterroles: "集群角色",
|
clusters_clusterroles: "集群角色",
|
||||||
clusters_repos: "集群仓库",
|
clusters_repos: "集群仓库",
|
||||||
@@ -274,6 +276,7 @@ const description = {
|
|||||||
i18n_user_administrator: "超级管理员,拥有所有对象的权限",
|
i18n_user_administrator: "超级管理员,拥有所有对象的权限",
|
||||||
i18n_user_manage_cluster: "集群管理员,拥有集群对象的所有权限",
|
i18n_user_manage_cluster: "集群管理员,拥有集群对象的所有权限",
|
||||||
i18n_user_manage_rbac: "角色与用户管理员,拥有用户管理对象的所有权限",
|
i18n_user_manage_rbac: "角色与用户管理员,拥有用户管理对象的所有权限",
|
||||||
|
i18n_user_manage_repo: "镜像仓库管理员,拥有镜像仓库对象的所有权限",
|
||||||
i18n_user_manage_readonly: "只读用户,只拥有所有对象的访问权限",
|
i18n_user_manage_readonly: "只读用户,只拥有所有对象的访问权限",
|
||||||
i18n_user_common_user: "普通用户,只拥有集群对象访问权限",
|
i18n_user_common_user: "普通用户,只拥有集群对象访问权限",
|
||||||
i18n_user_manage_chart: "Chart仓库管理员, 拥有对Chart仓库的所有权限",
|
i18n_user_manage_chart: "Chart仓库管理员, 拥有对Chart仓库的所有权限",
|
||||||
|
Reference in New Issue
Block a user