There is an agent-type management backend with many permission roles and many single-page operation buttons.
Excuse me, a relatively mature approach, how to maintain the relationship between this kind of operation button and permissions?
Display different buttons for different roles.
Never write an if else in the view for each character,
There is an agent-type management backend with many permission roles and many single-page operation buttons.
Excuse me, a relatively mature approach, how to maintain the relationship between this kind of operation button and permissions?
Display different buttons for different roles.
Never write an if else in the view for each character,
You can encapsulate a unified public method to specifically judge permissions. You can refer to this article. There is a section in the article about page operation buttons not being displayed without permission.
You can see http://www.5idev.com/p-php_cl... This link has detailed instructions.
<code>class 子类 extends 父类{ //code }</code>
For example, in the control layer - the class name is controls.php, and the member page is called memberControl.php. This class can inherit controls.php
controls.php
<code>class controls{ //code }</code>
memberControl.php
<code>class memberControl extends controls{ //code }</code>