Codeigniter 管理用户角色 [英] Codeigniter managing user roles

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

问题描述

如何划分多个用户的访问权限?我第一次通过为 3 种类型的用户创建不同的仪表板来做到这一点,例如管理员重定向到 user/admin/dashboard 和版主到 user/moderator/dashboard 等等.但我想通过了解用户角色并管理他们的访问来找到一种简单的方法来做到这一点.我的用户表看起来像:mysql:

How to divide multiple users access and permissions? i did it first time by creating different dashboard for 3 type users for example administrators redirected to user/admin/dashboard and moderators to user/moderator/dashboard and and so on. but i want to find an easy way to do this by knowing user roles and manage their access. my user table is something looks likes : mysql:

CREATE TABLE IF NOT EXISTS `users` (
  `user_id` int(9) NOT NULL AUTO_INCREMENT,
  `email_add` varchar(35) COLLATE utf8_bin DEFAULT NULL,
  `password` varchar(128) COLLATE utf8_bin NOT NULL,
  `last_login` datetime NOT NULL,
  `usr_typ_id` int(4) DEFAULT NULL,
  `permissions` varchar(50) COLLATE utf8_bin DEFAULT NULL,
  PRIMARY KEY (`user_id`),
  UNIQUE KEY `email_add` (`email_add`),
  KEY `fk_usr_typ_id` (`usr_typ_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=92090005 ;

-

ALTER TABLE `users`
  ADD CONSTRAINT `fk_usr_typ_id` FOREIGN KEY (`usr_typ_id`) REFERENCES `user_type` (`type_id`);

一旦我使用了 Drupal,它就完美了,我希望看起来像那样,没有完全那样的.:)

Once i used drupal it was perfect, i wish just something look likes that,nothing completely like that.:)

推荐答案

使用权限 类.

观看此视频,了解实际效果.

Watch this video to see this in action.

这篇关于Codeigniter 管理用户角色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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