Tell me how to properly display the page to the user, depending on his rights. For example, one role has some buttons, and the other others. Faced with one project with the if condition in which a lot of places get into the markup with large numbers of roles => if you need to change the interface mapping for a particular role, you will have to edit it in N places, not in one place.

How succinctly to solve such problems?

  • And how do you see the solution? Make each page a different page? And if you need to change the layout, duplicate each of the pages of roles? - MihailPw
  • @ AGS17, for each of the roles, too, probably not entirely correct ... Since you have to maintain many pages. Maybe through partial submissions? - iluxa1810
  • and how are you going to crush these parshaly? - MihailPw
  • @ AGS17, you are hinting that the practice described in the question is normal and you can’t get away from it? - iluxa1810
  • in most cases, yes. I saw practitioners when I added extensions, but this applies only to individual controls (such as links, for example) - MihailPw

1 answer 1

If only one role can correspond to one user, then on each page a list of roles is assigned to which it will be provided.

If several roles can correspond to one user, then the list of roles to which it will be provided is hung up on each control element.

Roles intersecting elements are given to the user, not intersecting - not given.

You can consider this from the point of view of the file system, where the roles are user groups, folders are pages, and files are controls.