php - Ion Auth in_group() - 多个组(按 id)
问题描述
我的应用程序中有一些关于 Ion Auth in_group 函数的奇怪行为。
我经过身份验证的用户是第 2 组的一部分。当我执行代码$this->ion_auth->in_group(2)?'success':'fail';
时,结果是“成功”,这是预期的结果。
$this->ion_auth->in_group(2,4,5)?'success':'fail';
传递一个类似, $this->ion_auth->in_group(array(2,4,5))?'success':'fail';
or的数组$this->ion_auth->in_group($group_ids)?'success':'fail';
总是会导致“失败”,这是意料之外的。
我可以确认$group_ids
结构正确:
Array
(
[0] => 2
[1] => 4
[2] => 5
)
正如Ion Auth 文档所解释的那样:TRUE if the user is in any of the given groups, FALSE otherwise.
我可能做错了什么?
使用的 Ion Auth 版本:2.5.2
作为当前的工作(我不想要硬编码的组),我正在使用$this->ion_auth->in_group('order')?'success':'fail';
我的数据库看起来像这样:
INSERT INTO user_groups(id, name, description, can_order)
VALUES(1,'admin','admin',0),
(2,'order','internal',1),(3,'controller','controller',0),
(4,'order','external 1',1),(5,'order','external 2',1)
解决方案
尝试使用来自Github中“2”分支的最新 Ion Auth 代码。几个月前对组内功能进行了错误修复,它可能是相关的。
推荐阅读
- oracle - 无法确定“ORA-00922:缺少或无效选项”错误的原因
- ruby-on-rails - MiniTest 控制器更新 - 预期响应为 <3XX: redirect>,但为 <200: OK>
- node.js - 使用 node express 将签名的 S3 URL 发送到浏览器
- bash - 将具有很长逗号分隔的数字字符串的文件拆分为多个文件
- python - 每次矩形与其他矩形碰撞时,我的分数都会增加很多
- sql - 如何仅显示列 postgres 中的一个值
- c++ - 如何理解 cls* (*) (int, double)
- c# - 在更新绑定对象之前验证 Cell 输入
- python-3.x - 使用 pandas 读取 xlrd 模块的 Excel 文件问题
- c++ - c ++中的这种合并排序算法有什么问题