简体   繁体   中英

Session variable arrangement for user management in multiple roles

How can I manage same session variables for two users one admin and another his subordinate. so that admin can visit in his sub-ordinate user accounts without getting logged out of his own ??

So you have two user groups admin and staffs. I would have designed the database as tbl_users(id, username, usertype). Here usertype is an enum containing either 'admin' for admin or 'staff' for staff. When the user logs in, i would put the usertype and username in the session variable. Depending on this value (usertype) I would allow admin and staff functions. ie if usertype is admin then allow the user to query all the other staff data, else dont allow.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM