If we follow role-menu, the front-end must save the relationship between role and menu (let’s call it roleMenuList for now, of course, this list is usually obtained from the background), which can be a list with pure ID,
roleMenuList: [1,2,3,4,5]
When rendering and traversing the menu on the page, it is judged whether the menu item id exists in roleMenuList. If so, it will be displayed, otherwise it will be hidden.
For button permissions, an identifier similar to id is also needed to identify this element. You can use custom attributes, such as
<button authorCode="myButtion"></button>
Get a button permission list from the backend. The element that contains myButtion needs to be hidden or disabled, for example
buttonAuthorList = [
{ code: 'myBution', to: 'disabled'},
{ code: 'hisBution', to: 'hidden'}
...
]
After recognizing the code identifier, perform the corresponding operations. Of course, the ones mentioned here are just simple examples, and the attributes still need to be carefully and strictly defined~
You can refer to windows: Account -> Role -> Permissions; Permissions can be whitelisted/blacklisted or used together; Back-end verification, the front-end will tailor and process it based on the role and permissions list behind the certificate.
If we follow role-menu, the front-end must save the relationship between role and menu (let’s call it roleMenuList for now, of course, this list is usually obtained from the background), which can be a list with pure ID,
When rendering and traversing the menu on the page, it is judged whether the menu item id exists in roleMenuList. If so, it will be displayed, otherwise it will be hidden.
For button permissions, an identifier similar to id is also needed to identify this element. You can use custom attributes, such as
Get a button permission list from the backend. The element that contains myButtion needs to be hidden or disabled, for example
After recognizing the code identifier, perform the corresponding operations. Of course, the ones mentioned here are just simple examples, and the attributes still need to be carefully and strictly defined~
You can refer to windows: Account -> Role -> Permissions;
Permissions can be whitelisted/blacklisted or used together;
Back-end verification, the front-end will tailor and process it based on the role and permissions list behind the certificate.
I have made a php+mysql comment function before. Edit, delete and other buttons are not displayed for non-current users. It is relatively simple.