网络中的自定义用户角色. [英] custom user roles in a web.

查看:80
本文介绍了网络中的自定义用户角色.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的网站中拥有用户管理功能,其中我拥有管理员和简单用户管理员可以简单地管理网站,例如添加和删除用户,产品等,并且用户可以通过登录来简单地购买骄傲..

我正在使用会话执行此任务.我只想在我的网站中添加角色,以便我可以使用户成为管理员或用户.我们该怎么做?

i have user management in my website in which i have the administrators and simples users administrators can simple manage the website e.g add and delete users , products e.t.c.. and users can simply buy proudcts.. by signing in..

i am doing this task using session.. i just want to add roles in my web site so i can make users administrators or users . how can we do it?? any artical on this please help??

推荐答案

在您的数据库中,单独创建一个名为Roles的表,其中Role和ID为列,在此处定义角色

像ID为1的管理员
ID为2等的用户

在userTable中,创建一个名为RoleID的列,并根据需要从Roles Table中为每个用户分配RoleID
In your database make a separate table named Roles with Role and ID as columns,define roles here

Like admin with id 1
user with id 2 etc

In your userTable,make a column named RoleID and assign each user the roleID as per you want from Roles Table


这篇关于网络中的自定义用户角色.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆