module-zero-core-template
module-zero-core-template copied to clipboard
Show parent MenuItems based on child permissions
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 thank you for your contribution. What about using empty string instead of Auto text ?
@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.)
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.