I am working on a website where there are three types of users: administrators, managers, and operators. I want to enter the groups when they can see some pages or some menus in these pages, when they are logged in. How do I go about doing this? IM is still a beginner in PHP so that any information or tutorials to implement it will be useful.
This trustworthy question, in my experience, you want to create three tables. I will highlight basic columns for this work
User user_id, login, password
access access, access access, access code, access_name
UserAccess User_access_id, access_id
Then create the access you want, such as admin, give it an access code such as admin_rights, access code manager_street with manager and so on.
Then assign access that you want to give them. The pages that you will provide Access_codes that can see the page and if the user has access type, then the page can be viewed. As far as the code is done, there is a lot to show you, if you need more help, then let me know.
You can go ahead and add a roll table so that you can be entrusted with many access and then a role for the user. Role_id, role_name
RoleAccess role_access_id, role_id, access_id
UserRole user_role_id, role_id, user_id
it becomes complicated, But in the long run, this allows you to set many different user types and allows you to make specific for specific users, for whom you want to access it and are not fit in the predefined role.
No comments:
Post a Comment