module-zero-core-template icon indicating copy to clipboard operation
module-zero-core-template copied to clipboard

Show parent MenuItems based on child permissions

Open andrehaupt opened this issue 5 years ago • 3 comments

The proposed code allow parent MenuItems to be shown/hidden based on the permissions of the child items. At persent, if a user does not have access to any child MenuItems, the empty parent will always show (unless a specific permission is assigned to the parent element). With the proposed code, if the parent permissionName is 'Auto', the parent display state will be infered from the child items.

andrehaupt avatar Oct 26 '19 13:10 andrehaupt

@andrehaupt thank you for your contribution. What about using empty string instead of Auto text ?

ismcagdas avatar Oct 27 '19 07:10 ismcagdas

@andrehaupt thank you for your contribution. What about using empty string instead of Auto text ?

That's the way I had it originally, but I thought it would then always hide the parent if the user did not have access to any of the child elements. I guess this is ok though.

Let me know if I should resubmit.

(Loving the projet by the way. Thanks for doing this.)

andrehaupt avatar Oct 28 '19 06:10 andrehaupt

Thanks 😄 . I think it is better to use menuItem.permissionName === '' instead of menuItem.permissionName === 'Auto'. But it is something minor. If you can change that, I will merge the PR and it can be released with the next version.

Thanks again.

ismcagdas avatar Oct 28 '19 08:10 ismcagdas