drupal中如何限制成员的视图
我只是创建一个视图来显示所有注册会员的个人资料详细信息。但问题是管理员可以看到所有会员详细信息,而会员也只能看到他们的详细信息。现在我想限制视图,管理员可以看到所有成员,成员可以看到他们的详细信息本身。
我怎么做?
我还想创建一个权限,例如管理员可以查看所有详细信息,经理可以查看一些受限数据,会员也有一些限制。
I just create a view for showing all registered members profile details. But the problem is admin can see all Member details and also Members can see only their details. Now i want to restrict the view by, Admin can see all members and the Member can see their details itself.
How i do it ?
And also i want create a privilege, for example Admin can see all details, Managers can see some restricted data and the Members also have some restrictions.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 hook_perm 来创建自定义权限。
现在您可以将视图的访问控制设置为您的自定义权限。
You can use hook_perm to create custom permissions.
Now you can set the View's access control to your custom permission.
一些想法:
如果您使用内容配置文件模块(该模块为用户信息创建 CCK 内容类型),您可以使用 CCK 中内置的内容权限来限制对特定字段的访问。
您还可以在视图中使用“User:Current”过滤器,该过滤器应将视图过滤到当前登录的用户。
A couple of ideas:
If you use the content profile module, which creates a CCK content type for user information, you can use the content permissions built into CCK to restrict access to particular fields.
You could also in the view use a filter of "User:Current" which should filter the view to the current logged in user.