如何授予特定用户对特定节点的编辑权限?

发布于 2024-08-21 20:39:52 字数 87 浏览 13 评论 0原文

如何授予特定用户对特定节点的编辑权限?

我有一个名为“学生”的用户角色。多个用户具有该角色,但只有少数用户可以编辑节点。我怎样才能意识到这一点?

How do I give a specific user editing rights to a specific node?

I have a user role named "Student". Multiple users have that role, only a few of them can edit a node. How can I realise this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

写下不归期 2024-08-28 20:39:52

我将尝试介绍一些用例,以及如何解决它们:

  1. 如果一类用户的所有成员都可以编辑某种类型的任何节点
    • 为该用户子集(如 Emyr 建议的“超级学生”)创建一个新角色,并通过 Drupal 的核心权限系统授予他们“编辑类型内容”权限(无需节点访问模块)
  2. 如果类别用户可以编辑特定节点
    • 为该用户子集创建一个新角色,并授予他们对特定节点的编辑权限(需要节点访问模块,例如 节点访问内容访问)。这还要求某人拥有权限(和时间)来在创建新节点时授予对该角色的访问权限。
  3. 部分用户可以编辑部分节点;不存在可以编辑所有节点的“精英”用户组,并且并非所有成员都可以编辑相同的节点
    • 这将需要节点访问模块,例如使用 ACL 的节点访问或内容访问。还需要有管理用户,他们有权授予其他用户编辑节点的权限。
  4. 允许用户授予其他人编辑他们创建的节点的权限。
    • 我最近使用用户参考 CCK 字段和节点访问用户参考实现了这一点。您可以通过核心权限系统授予用户编辑自己节点的权限,然后他们可以将其他用户添加到用户引用字段。在我的例子中,创建者没有获得该权限,我将该字段的默认值设置为创建者的用户 ID,这允许用户删除自己编辑节点的权限。

这些都假设您的内容没有分类。如果您的内容和用户组织得足够好,您也许能够利用基于分类法或有机组的节点访问模块。

I'll try and cover a few use cases, with how I would solve them:

  1. If all members of a category of users can edit any node of a certain type
    • Create a new role for that subset of users ('Super Students', as Emyr suggested) and grant them 'Edit content of type' permissions through Drupal's core permission system (no node access module required)
  2. If all members of a category of users can edit specific nodes
    • Create a new role for that subset of users and grant them edit permissions on the specific nodes (a node access modules is required, such as Node Access or Content Access). This will also require that someone has the permissions (and time) to grant access to the role whenever a new node is created.
  3. Some users can edit some nodes; there is no 'elite' group of users who can edit all nodes, and not all members can edit the same nodes
    • This will require a node access module, such as Node Access or Content Access with ACL. There will also need to be administrative users who have the permission to grant other users access to edit the nodes.
  4. Allow users to grant others access to edit a node they have created.
    • I implemented this recently with a user reference CCK field and Node Access User Reference. You can grant users permission to edit their own nodes through the core permissions system and they can then add other users to the user reference field. In my case creators are not given that permission and I set up the default value of the field to the creator's user id, which allows a user to remove themselves from being able to edit the node.

These all assume there is no categorization for your content. You may be able to utilize node access modules based on Taxonomy or Organic Groups if your content and users are organized sufficiently.

意中人 2024-08-28 20:39:52

对于像这样的异常权限问题,我总是发现一个小的自定义模块是可行的方法。通用节点访问模块必须足够通用才能适用于许多不同的情况,这通常使它们有点混乱和混乱。

对于这个特定的,您可以创建一个实现 hook_nodeapi 的模块,并在 $op==prepare 上,根据您的用户引用检查用户的 ID,如果不匹配,则执行 drupal_goto 访问拒绝页面。

For sort of abnormal permissions stuff like this, I've always found that a small custom module is the way to go. General node access modules have to be general enough to be useful for a lot of different cases, which generally makes them sort of messy and confusing.

For this specific one, you could create a module that implements hook_nodeapi and on $op==prepare, check the user's ID against your user reference and do a drupal_goto the access denied page if they don't match up.

沒落の蓅哖 2024-08-28 20:39:52

您可以使用 Flexi Access 来完成此操作。授予特定用户节点上的“更新”权限将允许他编辑该节点。

有关更多选项,请参阅页面:节点访问模块概述 @ Drupal.org。

You can do this with Flexi Access. Giving a specific user the "update" privilege on a node will allow him to edit the node.

For more options, see the page: Overview of Node Access modules @ Drupal.org.

合久必婚 2024-08-28 20:39:52

您是否尝试过节点访问内容访问

Have you tried either Node Access or Content Access?

十级心震 2024-08-28 20:39:52

如果只有一个子集能够编辑节点,则您需要一个额外的“超级学生”角色。

节点访问模块可以帮助您在节点上设置适当的权限。以下是其项目页面的摘录:

...为菜单、菜单项、节点以及管理和帮助系统的安全集成提供角色和用户特定的安全权限。我们希望向社区提供这套模块,以分享该套件的实用性,并让社区参与提供额外的支持、测试和审核。
我们特别注意确保权限管理的可用性在系统的所有部分(节点、菜单、菜单项)中保持一致。此外,每个安全模块都使用级联安全方案来实现全局安全,并可以选择覆盖或定义单个项目的安全模型的例外情况。

If only a subset should be able to edit nodes, you need an additional "super student" role.

The Node Access module may help you set appropriate permissions on the nodes. Here is an excerpt from its project page:

... provides roles and user specific security permissions for menus, menu items, nodes, and security integration into the administration and help systems. We would like to provide this suite of modules back to the community to share the usefulness of the suite and involve the community to provide additional support, testing, and moderation.
Special care was taken to ensure the usability of permission management was consistent across all sections of the system (nodes, menus, menu items). Also each security module uses a cascading security scheme to allow global security and the option to override or define exceptions to the security model for individual items.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文