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

The error message is not user-friendly when adding duplicate permissi… #12805

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

zhouchunhai
Copy link
Contributor

@zhouchunhai zhouchunhai commented Oct 31, 2024

…ons. (#12773)

What is the purpose of the change

The error message is not user-friendly when adding duplicate permissions.

Copy link

Thanks for your this PR. 🙏
Please check again for your PR changes whether contains any usage/api/configuration change such as Add new API , Add new configuration, Change default value of configuration.
If so, please add or update documents(markdown type) in docs/next/ for repository nacos-group/nacos-group.github.io


感谢您提交的PR。 🙏
请再次查看您的PR内容,确认是否包含任何使用方式/API/配置参数的变更,如:新增API新增配置参数修改默认配置等操作。
如果是,请确保在提交之前,在仓库nacos-group/nacos-group.github.io中的docs/next/目录下添加或更新文档(markdown格式)。

@codecov-commenter
Copy link

codecov-commenter commented Oct 31, 2024

Codecov Report

Attention: Patch coverage is 0% with 11 lines in your changes missing coverage. Please review.

Project coverage is 72.13%. Comparing base (aeaaded) to head (ca89ce1).

Files with missing lines Patch % Lines
...s/plugin/auth/impl/roles/NacosRoleServiceImpl.java 0.00% 10 Missing ⚠️
...gin/auth/impl/controller/PermissionController.java 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##             develop   #12805      +/-   ##
=============================================
- Coverage      72.17%   72.13%   -0.05%     
+ Complexity      9792     9791       -1     
=============================================
  Files           1283     1283              
  Lines          41387    41398      +11     
  Branches        4374     4378       +4     
=============================================
- Hits           29872    29863       -9     
- Misses          9408     9427      +19     
- Partials        2107     2108       +1     
Files with missing lines Coverage Δ
...gin/auth/impl/controller/PermissionController.java 87.50% <0.00%> (-12.50%) ⬇️
...s/plugin/auth/impl/roles/NacosRoleServiceImpl.java 25.67% <0.00%> (-1.87%) ⬇️

... and 2 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update aeaaded...ca89ce1. Read the comment docs.

---- 🚨 Try these New Features:

@wuyfee
Copy link

wuyfee commented Oct 31, 2024

$\color{green}{SUCCESS}$
DETAILS
✅ - docker: success
✅ - deploy (standalone & cluster & standalone_auth): success
✅ - e2e-java-test (standalone & cluster & standalone_auth): success
✅ - e2e-go-test (standalone & cluster): success
✅ - e2e-cpp-test (standalone & cluster): success
✅ - e2e-csharp-test (standalone & cluster): success
✅ - e2e-nodejs-test (standalone & cluster): success
✅ - e2e-python-test (standalone & cluster): success
✅ - clean (standalone & cluster & standalone_auth): success

@KomachiSion
Copy link
Collaborator

Is relatived with #12803?

@zhouchunhai
Copy link
Contributor Author

It's relatived with #12773

@KomachiSion
Copy link
Collaborator

But I think add these two http api can't solve this problem.

the console ui will not call these two api.

@zhouchunhai
Copy link
Contributor Author

My colleague has already submitted a Pull Request (PR). The console ui will call the new API to check if the permission already exists.

@KomachiSion
Copy link
Collaborator

My colleague has already submitted a Pull Request (PR). The console ui will call the new API to check if the permission already exists.

So I ask you whether your pr is relative with #12803 ?

@zhouchunhai
Copy link
Contributor Author

yes, it's relative with #12803

@KomachiSion KomachiSion added the area/Nacos console Related to Nacos consle label Nov 12, 2024
@KomachiSion KomachiSion added this to the 2.5.0 milestone Nov 12, 2024
*/
@GetMapping
@Secured(resource = AuthConstants.CONSOLE_RESOURCE_NAME_PREFIX + "permissions", action = ActionTypes.READ)
public Boolean isDuplicatePermission(@RequestParam String role, @RequestParam String resource, @RequestParam String action) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we response with Result?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if not response with a result, how can ui judge whether a permission is duplicate

Copy link
Collaborator

@KomachiSion KomachiSion Nov 21, 2024

Choose a reason for hiding this comment

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

I mean response with class com.alibaba.nacos.api.model.v2.Result not only return an Boolean.

@wuyfee
Copy link

wuyfee commented Nov 21, 2024

$\color{red}{FAILURE}$
DETAILS
✅ - docker: success
✅ - deploy (standalone & cluster & standalone_auth): success
✅ - e2e-java-test (standalone & cluster & standalone_auth): success
✅ - e2e-go-test (standalone & cluster): success
✅ - e2e-cpp-test (standalone & cluster): success
❌ - e2e-csharp-test (standalone & cluster): failure
✅ - e2e-nodejs-test (standalone & cluster): success
✅ - e2e-python-test (standalone & cluster): success
✅ - clean (standalone & cluster & standalone_auth): success

*/
@GetMapping
@Secured(resource = AuthConstants.CONSOLE_RESOURCE_NAME_PREFIX + "permissions", action = ActionTypes.READ)
public Boolean isDuplicatePermission(@RequestParam String role, @RequestParam String resource, @RequestParam String action) {
Copy link
Collaborator

@KomachiSion KomachiSion Nov 21, 2024

Choose a reason for hiding this comment

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

I mean response with class com.alibaba.nacos.api.model.v2.Result not only return an Boolean.

@wuyfee
Copy link

wuyfee commented Nov 21, 2024

$\color{red}{FAILURE}$
DETAILS
✅ - docker: success
✅ - deploy (standalone & cluster & standalone_auth): success
✅ - e2e-java-test (standalone & cluster & standalone_auth): success
✅ - e2e-go-test (standalone & cluster): success
✅ - e2e-cpp-test (standalone & cluster): success
❌ - e2e-csharp-test (standalone & cluster): failure
✅ - e2e-nodejs-test (standalone & cluster): success
✅ - e2e-python-test (standalone & cluster): success
✅ - clean (standalone & cluster & standalone_auth): success

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/Nacos console Related to Nacos consle
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants