unkey
unkey copied to clipboard
Permission ordering should show shallow permissions first
Preliminary Checks
- [X] I have reviewed the documentation: https://unkey.dev/docs
- [X] I have searched for existing issues: https://github.com/unkeyed/unkey/issues
- [X] This issue is not a question, general help request, or anything other than a bug report directly related to Unkey. Please ask questions in our Discord community: https://unkey.dev/discord.
Reproduction / Replay Link (Optional)
No response
Issue Summary
All non-nested permissions should show before nested permissions
Steps to Reproduce
- (for example) Went to ...
- Clicked on...
- ...
Expected behavior
The order should be:
- domain
- delete_domain
- read_domain
- update_domain
- dns
- create_record
- delete_record
- read_record
- update_record
Other information
No response
Screenshots
No response
Version info
- OS:
- Node:
- npm:
hey @chronark,
I have made some changes to tree component. Added a function that maps over nestedPermissions then every checks every permission if it as any nested permission if it contain then pushes to bottom of array and if doesn't then pushes to top of array.
And then finally we map over the sortedNestedPermissions array and return recursivePermission component.
It works as Excepted!!
https://www.loom.com/share/87013f98356f467da5752b5b0abbf543?sid=92c83072-0a95-429a-bb77-0e08af5c23e9
Any feedback would be appericated!
Nice, thank you
can you still sort alphabetically within one depth? Right now they are out of order, it should be
- delete_record
- read_record
- update_record
- write_record
Can this issue be assigned to me? I have fixed the sorting order.
Here is the sorter function:
Sorting the arrays using .sort
before mapping:
Permissions in proper order:
/assign
Assigned to @DeepaPrasanna! Please open a draft PR linking this issue within 48h ⚠️ If we can't detect a PR from you linking this issue in 48h, you'll be unassigned automatically 🕹️ Excited to have you ship this 🚀
/assign
This issue is already assigned to another person. Please find more issues here.
/assign
This issue is already assigned to another person. Please find more issues here.
/assign
This issue is already assigned to another person. Please find more issues here.
/assign
This issue is already assigned to another person. Please find more issues here.
/assign
This issue is already assigned to another person. Please find more issues here.