Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于用户的接口,建议聚合返回用户的角色信息 #3342

Closed
ruibaby opened this issue Feb 20, 2023 · 0 comments · Fixed by #3372 or halo-dev/console#882
Closed

关于用户的接口,建议聚合返回用户的角色信息 #3342

ruibaby opened this issue Feb 20, 2023 · 0 comments · Fixed by #3372 or halo-dev/console#882
Assignees
Labels
area/core Issues or PRs related to the Halo Core kind/feature Categorizes issue or PR as related to a new feature. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now.
Milestone

Comments

@ruibaby
Copy link
Member

ruibaby commented Feb 20, 2023

你当前使用的版本

2.2.1

描述一下此特性

image

{
  "page": 1,
  "size": 20,
  "total": 3,
  "items": [
    {
      "spec": {
        "displayName": "Ryan Wang",
        "avatar": "",
        "email": "[email protected]",
        "phone": "",
        "password": "",
        "bio": "",
        "disabled": false,
        "loginHistoryLimit": 0
      },
      "status": {
        "permalink": "http://localhost:8090/authors/ryanwang"
      },
      "apiVersion": "v1alpha1",
      "kind": "User",
      "metadata": {
        "finalizers": [
          "user-protection"
        ],
        "name": "ryanwang",
        "annotations": {
          "rbac.authorization.halo.run/role-names": "[\"super-role\"]"
        },
        "version": 5,
        "creationTimestamp": "2023-02-17T13:49:13.902746Z"
      }
    }
  ],
  "first": true,
  "last": true,
  "totalPages": 1,
  "hasNext": false,
  "hasPrevious": false
}

如上,目前仅返回了角色的 name,无法方便的在前端显示角色的名称等信息,建议用户相关的自定义接口都将角色信息聚合返回。

/area core
/kind feature

附加信息

No response

@f2c-ci-robot f2c-ci-robot bot added area/core Issues or PRs related to the Halo Core kind/feature Categorizes issue or PR as related to a new feature. labels Feb 20, 2023
@ruibaby ruibaby added this to the 2.3.x milestone Feb 20, 2023
@ruibaby ruibaby added the priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. label Feb 22, 2023
f2c-ci-robot bot pushed a commit to halo-dev/console that referenced this issue Feb 24, 2023
#### What type of PR is this?

/kind improvement

#### What this PR does / why we need it:

重构获取用户信息的请求方式,无需再请求所有角色即可获取当前用户的角色信息,适配:halo-dev/halo#3372

相关 PR:#847

#### Which issue(s) this PR fixes:

Fixes halo-dev/halo#3342

#### Special notes for your reviewer:

测试方式:

1. Halo 需要切换到 halo-dev/halo#3372 分支。
2. Console 需要 `pnpm install && pnpm build:packages`
3. 测试用户列表、登录、检查角色信息是否显示正确。

#### Does this PR introduce a user-facing change?

```release-note
优化 Console 端用户角色标识的显示名称。
```
@ruibaby ruibaby modified the milestones: 2.3.x, 2.3.0 Feb 24, 2023
JohnNiang pushed a commit that referenced this issue Feb 24, 2023
#### What type of PR is this?
/kind feature
/kind api-change
/area core
/milestone 2.3.x

#### What this PR does / why we need it:
获取用户信息的 API 响应体包含关联角色信息

- 新增 API `/apis/api.console.halo.run/v1alpha1/users/{name}`
- 修改了 API 的返回值类型 `/apis/api.console.halo.run/v1alpha1/users/-`

由于 API 响应体结构的改变,需要 Console 适配
#### Which issue(s) this PR fixes:

Fixes #3342

#### Special notes for your reviewer:
/cc @halo-dev/sig-halo 
#### Does this PR introduce a user-facing change?

```release-note
获取用户信息的 API 响应体包含关联角色信息
```
JohnNiang pushed a commit to JohnNiang/halo that referenced this issue Mar 2, 2023
#### What type of PR is this?

/kind improvement

#### What this PR does / why we need it:

重构获取用户信息的请求方式,无需再请求所有角色即可获取当前用户的角色信息,适配:halo-dev#3372

相关 PR:halo-dev/console#847

#### Which issue(s) this PR fixes:

Fixes halo-dev#3342

#### Special notes for your reviewer:

测试方式:

1. Halo 需要切换到 halo-dev#3372 分支。
2. Console 需要 `pnpm install && pnpm build:packages`
3. 测试用户列表、登录、检查角色信息是否显示正确。

#### Does this PR introduce a user-facing change?

```release-note
优化 Console 端用户角色标识的显示名称。
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core Issues or PRs related to the Halo Core kind/feature Categorizes issue or PR as related to a new feature. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now.
Projects
None yet
2 participants