-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
README.md中,举例疑有误 #6
Comments
没有问题的, |
之所以有这个问题,是因为昨天 试了以下代码,与预期结果不符 // 对eve用户添加 articles read 权限
Enforcer::addPermissionForUser('eve', 'articles', 'read');
// 对 writer 角色添加 articles edit 权限
Enforcer::addPermissionForUser('writer', 'articles','edit');
// 对eve用户添加 writer 角色
Enforcer::addRoleForUser('eve', 'writer');
// 至此 eve 应有 articles read 权限,以及 writer 所包含的 articles edit 权限
Enforcer::hasPermissionForUser('eve', 'articles', 'edit'); // 结果为 false 仔细看完readme.md后,发现实际上有两个方法: // 决定某个用户是否拥有某个权限
Enforcer::hasPermissionForUser('eve', 'articles', 'edit'); // 结果为 false
// 检查一个用户是否拥有某个权限
Enforcer::enforce('eve', 'articles', 'edit'); // 结果为 true 按结果 来猜测: 仅从现有的中文注释来看,比较难区分二者的区别。 另外,想知道 这里的 第2参数 |
@MrXBear 参数的顺序则是根据 |
明白了 |
项目的 readme.md 文件中
赋予权限给某个用户或角色:
删除某个用户或角色的所有权限:
两处 均各举 to user 与 to role 的例子
但 注释为 to role 的例子,均为 xxxForUser( )
The text was updated successfully, but these errors were encountered: