Hi dear Nocobase team,
In previous versions of NocoBase, it was easy to determine whether a user was using the ‘Full permissions’ role union or a single selected role because ctx.role returned a value of __union__. However, this changed in the v2.1.12 release. Now, ctx.role returns a comma-separated list of all roles assigned to the user, making it difficult to distinguish whether ‘Full permissions’ is active or just an individual role.
Simply checking for the presence of a comma in ctx.role isn’t a secure or reliable solution since a user might only have a single role assigned to them. The alternative - comparing the ctx.role list against all roles associated with the user’s account and department - is overly complex and cannot be easily implemented within frontend block linkage rules.
Could you please recommend a clean way to handle this check? Ultimately, I need to dynamically show or hide a UI block based on whether ‘Full permissions’ is currently active.