From e4c258de8e8486ca0d1bdbcfbcaa7c30992500a2 Mon Sep 17 00:00:00 2001 From: ning <710leo@gmail.com> Date: Mon, 2 Jun 2025 09:24:37 +0800 Subject: [PATCH] refactor: change user ops --- center/cconf/ops.go | 6 ++++++ center/router/router.go | 8 ++++---- pkg/i18nx/var.go | 12 ++++++++++++ 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/center/cconf/ops.go b/center/cconf/ops.go index d765fb2b..45ce25d5 100644 --- a/center/cconf/ops.go +++ b/center/cconf/ops.go @@ -256,6 +256,12 @@ ops: ops: - name: /users cname: User - View + - name: /users/add + cname: User - Add + - name: /users/put + cname: User - Modify + - name: /users/del + cname: User - Delete - name: /user-groups cname: Team - View - name: /user-groups/add diff --git a/center/router/router.go b/center/router/router.go index ba716b0d..91fdcffe 100644 --- a/center/router/router.go +++ b/center/router/router.go @@ -264,11 +264,11 @@ func (rt *Router) Config(r *gin.Engine) { pages.DELETE("/self/token/:id", rt.auth(), rt.user(), rt.deleteToken) pages.GET("/users", rt.auth(), rt.user(), rt.perm("/users"), rt.userGets) - pages.POST("/users", rt.auth(), rt.admin(), rt.userAddPost) + pages.POST("/users", rt.auth(), rt.user(), rt.perm("/users/add"), rt.userAddPost) pages.GET("/user/:id/profile", rt.auth(), rt.userProfileGet) - pages.PUT("/user/:id/profile", rt.auth(), rt.admin(), rt.userProfilePut) - pages.PUT("/user/:id/password", rt.auth(), rt.admin(), rt.userPasswordPut) - pages.DELETE("/user/:id", rt.auth(), rt.admin(), rt.userDel) + pages.PUT("/user/:id/profile", rt.auth(), rt.user(), rt.perm("/users/put"), rt.userProfilePut) + pages.PUT("/user/:id/password", rt.auth(), rt.user(), rt.perm("/users/put"), rt.userPasswordPut) + pages.DELETE("/user/:id", rt.auth(), rt.user(), rt.perm("/users/del"), rt.userDel) pages.GET("/metric-views", rt.auth(), rt.metricViewGets) pages.DELETE("/metric-views", rt.auth(), rt.user(), rt.metricViewDel) diff --git a/pkg/i18nx/var.go b/pkg/i18nx/var.go index 142d1105..2588c029 100644 --- a/pkg/i18nx/var.go +++ b/pkg/i18nx/var.go @@ -137,6 +137,9 @@ var I18N = `{ "Organization": "人员组织", "User - View": "用户 - 查看", + "User - Add": "用户 - 新增", + "User - Modify": "用户 - 修改", + "User - Delete": "用户 - 删除", "Team - View": "团队 - 查看", "Team - Add": "团队 - 新增", "Team - Modify": "团队 - 修改", @@ -295,6 +298,9 @@ var I18N = `{ "Organization": "人員組織", "User - View": "用戶 - 查看", + "User - Add": "用戶 - 新增", + "User - Modify": "用戶 - 修改", + "User - Delete": "用戶 - 刪除", "Team - View": "團隊 - 查看", "Team - Add": "團隊 - 新增", "Team - Modify": "團隊 - 修改", @@ -450,6 +456,9 @@ var I18N = `{ "Organization": "組織", "User - View": "ユーザー - 閲覧", + "User - Add": "ユーザー - 追加", + "User - Modify": "ユーザー - 修正", + "User - Delete": "ユーザー - 削除", "Team - View": "チーム - 閲覧", "Team - Add": "チーム - 追加", "Team - Modify": "チーム - 修正", @@ -605,6 +614,9 @@ var I18N = `{ "Organization": "Организация", "User - View": "Пользователи - Просмотр", + "User - Add": "Пользователи - Добавить", + "User - Modify": "Пользователи - Изменить", + "User - Delete": "Пользователи - Удалить", "Team - View": "Команды - Просмотр", "Team - Add": "Команды - Добавить", "Team - Modify": "Команды - Изменить",