简体   繁体   English

用于多角色用户管理的会话变量安排

[英]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. 因此,您有两个用户组admin和staffs。 I would have designed the database as tbl_users(id, username, usertype). 我将数据库设计为tbl_users(id,username,usertype)。 Here usertype is an enum containing either 'admin' for admin or 'staff' for staff. 这里的用户类型是一个枚举,其中包含用于管理员的“ admin”或用于人员的“ 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. 即,如果用户类型为admin,则允许用户查询所有其他人员数据,否则不允许。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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