Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: show special roles at the end of the list#806

Merged
AlexAndBear merged 1 commit into
mainfrom
web/issues/648
May 10, 2025
Merged

fix: show special roles at the end of the list#806
AlexAndBear merged 1 commit into
mainfrom
web/issues/648

Conversation

@AlexAndBear

Copy link
Copy Markdown
Member

Description

image

Related Issue

Motivation and Context

How Has This Been Tested?

  • test environment:
  • test case 1:
  • test case 2:
  • ...

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation added

@AlexAndBear AlexAndBear requested a review from kulmann May 8, 2025 19:48
@AlexAndBear

Copy link
Copy Markdown
Member Author

Before caring about the tests, I'd love to know if this is matching the code standards 😼

@kulmann

kulmann commented May 9, 2025

Copy link
Copy Markdown
Member

Before caring about the tests, I'd love to know if this is matching the code standards 😼

I like the approach! Building two groups (normal and special) and then sorting those groups according to the weight prop sounds reasonable and gives us the expected result. 👍

@kulmann kulmann left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Code-wise this looks good to me.

Comment thread services/graph/pkg/unifiedrole/roles.go Outdated

@rhafer rhafer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry, but I am not really convinced that this approach is good. What exactly makes a role "special"? And even if we think they're somehow special, I don't think we should hardcode that somewhere deep in the code.

Roles already have weights for ordering them. We just set the weight to 0 everywhere and then try some clever sorting based on the number of permissions they grant. Maybe that is the wrong approach. Why not just initialize the weights correctly from the beginning and just sort by weights?

@micbar

micbar commented May 9, 2025

Copy link
Copy Markdown
Member

Sorry, but I am not really convinced that this approach is good. What exactly makes a role "special"? And even if we think they're somehow special, I don't think we should hardcode that somewhere deep in the code.

Roles already have weights for ordering them. We just set the weight to 0 everywhere and then try some clever sorting based on the number of permissions they grant. Maybe that is the wrong approach. Why not just initialize the weights correctly from the beginning and just sort by weights?

Same question here. Why do we override the backend weight? If something is wrong, we should change the weight in the backend.

@AlexAndBear AlexAndBear force-pushed the web/issues/648 branch 2 times, most recently from 0861272 to 8cb3ff9 Compare May 9, 2025 08:02
@AlexAndBear AlexAndBear requested review from kulmann and rhafer May 9, 2025 08:06
@AlexAndBear

AlexAndBear commented May 9, 2025

Copy link
Copy Markdown
Member Author

@tbsbdr can the gatekeeper give us their opinion

I'd rather show Can view (secure) under Can view and Cannot access at last.

@tbsbdr

tbsbdr commented May 9, 2025

Copy link
Copy Markdown
Member

I'd prefer the order like you propsed it.

Comment thread services/graph/pkg/unifiedrole/roles.go
@AlexAndBear AlexAndBear force-pushed the web/issues/648 branch 5 times, most recently from f8dcbe2 to dce298e Compare May 9, 2025 22:36
@AlexAndBear AlexAndBear merged commit 38169e6 into main May 10, 2025
@AlexAndBear AlexAndBear deleted the web/issues/648 branch May 10, 2025 09:23
@openclouders openclouders mentioned this pull request May 10, 2025
1 task
@kulmann

kulmann commented May 12, 2025

Copy link
Copy Markdown
Member

@rhafer @dragotin what do you think, can be backport this to stable-2.0? The original behaviour was quite annoying, but it's not more than that... don't know how strict you are with backports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Order of share roles

5 participants