CodeIgniter 认证+用户权限 [英] CodeIgniter authentication + user privileges

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

问题描述

我正在尝试在我的应用程序中构建一个身份验证系统,但我在决定哪种方式是我可以在 CodeIgniter 中实现我想要的最佳方式时遇到了一些问题.

I'm trying to build an authentication system in my application, but I'm having some problems in deciding which is the best way I could acomplish what I want in CodeIgniter.

该网站允许公司管理他们的建筑物.一家公司可以拥有许多建筑物和许多用户(当我说用户时,我指的是该公司的员工).

The website allows companies to manage their buildings. A company can have many buildings, and many users (when I say users I mean employees from that company).

在这个网站上,我希望有两个(基本上)四个一般类型的用户.

In this website I would like two have (basically) four general kind of users.

  • 超级管理员:这将能够向数据库添加新管理员和新公司,并为其他管理员授予权限.
  • 管理员:这将能够根据分配的权限执行不同的操作.
  • 公司超级用户:当管理员创建新公司时,将直接创建此用户.此用户将能够为该公司创建新用户,并且由于他/她拥有全部权限,因此他将能够执行其他用户可以执行的所有操作.
  • 公司用户:根据其超级用户分配的权限,该用户将能够执行和查看不同的数据(例如,一个简单的用户只能查看来自众多公司大楼之一的信息).

因此,即使我已经看到许多用于 CodeIgniter 的身份验证库,但很高兴听到有关我如何设计这个基于身份验证角色"的系统的任何建议,以及如果您特别推荐一个可以提供帮助的库来实现这一点.

So, even though I've seen many authentication libraries out there for CodeIgniter, it would be nice to hear any recommendations about how I could design this "authentication role based" system, and if you particularly recommend a library that could help to accomplish this.

欣赏!

推荐答案

在 Codeigniter 中有许多已经处理身份验证的库,但我推荐的是 Ion_Auth.它很好地处理了用户权限(组),我实际上已经做了一个 详细文章 概述了使用 Ion_Auth 处理这种情况的好方法.

There Are many libraries that already handle Authentication within Codeigniter, but the one I would recommend is Ion_Auth. It handles user permissions (groups) very well and I've actually done a detailed writeup outlining a good way to handle this situation with Ion_Auth.

这篇关于CodeIgniter 认证+用户权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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