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

feature: A user-friendly user management page for apollo portal #4464

Merged
merged 21 commits into from
Aug 2, 2022

Conversation

zcy1010
Copy link
Contributor

@zcy1010 zcy1010 commented Jul 14, 2022

What's the purpose of this PR

A user-friendly user management page for apollo portal

Which issue(s) this PR fixes:

Fixes #4294

Brief changelog

  • Modify the backend, add and modify users, and search the contents of the user interface
  • Modified the front-end management user interface

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Read the Contributing Guide before making this pull request.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit tests to verify the code.
  • Run mvn clean test to make sure this pull request doesn't break anything.
  • Update the CHANGES log.

@codecov-commenter
Copy link

codecov-commenter commented Jul 15, 2022

Codecov Report

Merging #4464 (1bab738) into master (63c16c1) will decrease coverage by 0.11%.
The diff coverage is 1.69%.

@@             Coverage Diff              @@
##             master    #4464      +/-   ##
============================================
- Coverage     53.63%   53.52%   -0.12%     
+ Complexity     2702     2701       -1     
============================================
  Files           489      489              
  Lines         15294    15325      +31     
  Branches       1588     1596       +8     
============================================
- Hits           8203     8202       -1     
- Misses         6535     6565      +30     
- Partials        556      558       +2     
Impacted Files Coverage Δ
...ip/framework/apollo/portal/entity/bo/UserInfo.java 52.17% <0.00%> (-7.83%) ⬇️
...trip/framework/apollo/portal/entity/po/UserPO.java 28.00% <0.00%> (-1.17%) ⬇️
...llo/portal/spi/defaultimpl/DefaultUserService.java 69.23% <ø> (ø)
...mework/apollo/portal/spi/ldap/LdapUserService.java 0.00% <ø> (ø)
...ollo/portal/spi/oidc/OidcLocalUserServiceImpl.java 0.00% <0.00%> (ø)
.../spi/springsecurity/SpringSecurityUserService.java 0.00% <0.00%> (ø)
...k/apollo/portal/controller/UserInfoController.java 42.30% <12.50%> (-12.70%) ⬇️
...ervice/service/ReleaseMessageServiceWithCache.java 84.70% <0.00%> (-1.18%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us.

@zcy1010
Copy link
Contributor Author

zcy1010 commented Jul 16, 2022

@nobodyiam please help me review the code.

@zcy1010 zcy1010 changed the title A user-friendly user management page for apollo portal feature: A user-friendly user management page for apollo portal Jul 16, 2022
Copy link
Member

@nobodyiam nobodyiam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are also several issues that need to be fixed.

  1. When the user is created/updated, the user list needs to be updated to reflect the changes.
    Now the administrator needs to refresh the page manually to see the newly added user or the updated user info.

  2. It's better to allow the administrator enable/disable the users without filling the passwords
    How about we add enable/disable buttons in the operation column?
    image

@zcy1010
Copy link
Contributor Author

zcy1010 commented Jul 18, 2022

2. to allow the administrator enable/disable the users without filling the passwords
How about we add enable/disable buttons in the operation

If the enable or disable is put outside and becomes a separate button, the backend needs to write a new interface,like

@PreAuthorize(value = "@permissionValidator.isSuperAdmin()")
@PostMapping("/user/enabled")
  public void changeUserEnabled(@RequestBody UserPO user) {
  }

Because the current interface checks that the password cannot be empty.

@PreAuthorize(value = "@permissionValidator.isSuperAdmin()")
@PostMapping("/users")
public void createOrUpdateUser(@RequestBody UserPO user) {
  if (StringUtils.isContainEmpty(user.getUsername(), user.getPassword())) {
    throw new BadRequestException("Username and password can not be empty.");
  }

  CheckResult pwdCheckRes = passwordChecker.checkWeakPassword(user.getPassword());
  if (!pwdCheckRes.isSuccess()) {
    throw new BadRequestException(pwdCheckRes.getMessage());
  }

  if (userService instanceof SpringSecurityUserService) {
    ((SpringSecurityUserService) userService).createOrUpdate(user);
  } else {
    throw new UnsupportedOperationException("Create or update user operation is unsupported");
  }
}

is it ok to add a new interface?

@nobodyiam
Copy link
Member

BTW, I think it's ok to add a new interface to enable/disable users.

Copy link
Member

@nobodyiam nobodyiam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically, it looks very good now! Please find some comments below.
BTW, please also update the CHANGES.md.

@zcy1010
Copy link
Contributor Author

zcy1010 commented Jul 29, 2022

@nobodyiam do you have any other suggestions :D

@nobodyiam
Copy link
Member

@zcy1010

It looks great now! There is one minor issue though. I think we need to disable the user login name field in the edit user page:

image

BTW, please also fix the conflict in CHANGES.md.

image

Copy link
Member

@nobodyiam nobodyiam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nobodyiam nobodyiam merged commit 1458a93 into apolloconfig:master Aug 2, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Aug 2, 2022
@nobodyiam nobodyiam added this to the 2.1.0 milestone Feb 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

A user-friendly user management page for apollo portal
4 participants