unkey icon indicating copy to clipboard operation
unkey copied to clipboard

Permission ordering should show shallow permissions first

Open chronark opened this issue 1 year ago • 14 comments

Preliminary Checks

Reproduction / Replay Link (Optional)

No response

Issue Summary

All non-nested permissions should show before nested permissions

CleanShot 2024-02-20 at 16 47 57@2x

Steps to Reproduce

  1. (for example) Went to ...
  2. Clicked on...
  3. ...

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:

chronark avatar Feb 20 '24 15:02 chronark

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.

image

And then finally we map over the sortedNestedPermissions array and return recursivePermission component.

image

It works as Excepted!!

https://www.loom.com/share/87013f98356f467da5752b5b0abbf543?sid=92c83072-0a95-429a-bb77-0e08af5c23e9

Any feedback would be appericated!

AkshayBandi027 avatar Feb 21 '24 09:02 AkshayBandi027

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 CleanShot 2024-02-21 at 10 24 08@2x

chronark avatar Feb 21 '24 09:02 chronark

Can this issue be assigned to me? I have fixed the sorting order.

Here is the sorter function:

image

Sorting the arrays using .sort before mapping:

image image

Permissions in proper order:

image image

kfahad5607 avatar Aug 01 '24 17:08 kfahad5607

/assign

DeepaPrasanna avatar Oct 07 '24 12:10 DeepaPrasanna

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 🚀

oss-gg[bot] avatar Oct 07 '24 12:10 oss-gg[bot]

/assign

nilaygit-10721 avatar Oct 10 '24 13:10 nilaygit-10721

This issue is already assigned to another person. Please find more issues here.

oss-gg[bot] avatar Oct 10 '24 13:10 oss-gg[bot]

/assign

aryanbansal73 avatar Oct 10 '24 19:10 aryanbansal73

This issue is already assigned to another person. Please find more issues here.

oss-gg[bot] avatar Oct 10 '24 19:10 oss-gg[bot]

/assign

aryanbansal73 avatar Oct 11 '24 07:10 aryanbansal73

This issue is already assigned to another person. Please find more issues here.

oss-gg[bot] avatar Oct 11 '24 07:10 oss-gg[bot]

/assign

suraj-xd avatar Oct 12 '24 05:10 suraj-xd

This issue is already assigned to another person. Please find more issues here.

oss-gg[bot] avatar Oct 12 '24 05:10 oss-gg[bot]

/assign

sour2001 avatar Oct 15 '24 18:10 sour2001

This issue is already assigned to another person. Please find more issues here.

oss-gg[bot] avatar Oct 15 '24 18:10 oss-gg[bot]