根据分类和内容类型向角色授予编辑权限

发布于 2024-10-21 21:41:38 字数 225 浏览 7 评论 0原文

我正在寻找一种根据节点的内容类型及其分类来管理 Drupal 6 节点上的编辑权限的方法。

例如,我希望能够允许角色编辑分类法 1 的故事和分类法 2 的页面,但不允许编辑分类法 2 的故事和分类法 1 的页面。

我知道如何按内容类型或分类(使用分类访问权限模块)限制访问,但我无法设法授予这两个条件的权限。我非常感谢模块建议或有关如何以编程方式制作它的一些想法。

预先感谢您的任何提示!

I'm looking for a way to manage edit permissions on Drupal 6 nodes based on the content-type of the node and on his taxonomy.

For example, I'd like to be able to allow a role to edit stories of taxonomy1 and pages of taxonomy2 but not stories of taxonomy2 and pages of taxonomy1.

I know how to restrict access by content type or by taxonomy (with the taxonomy access permissions module), but I can't manage to grant permissions on both of these criteria. I would greatly appreciate a module suggestion or some ideas on how to make it programmatically.

Thanks in advance for any hints !

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

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

发布评论

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

评论(1

我很OK 2024-10-28 21:41:38
function hook_menu_alter(&$items) {
   $items['node/%node/edit']['access callback'] = my_permission_function;
}

function my_permission_function($node){
  if( (node_type is 1 and tax_of_node is tax2)|| (node_type is 2 and tax_of_node is tax1)
     return TRUE;
  else return FALSE;
}

不是确切的代码。遵循逻辑。尝试这样的事情,它应该可以工作。

function hook_menu_alter(&$items) {
   $items['node/%node/edit']['access callback'] = my_permission_function;
}

function my_permission_function($node){
  if( (node_type is 1 and tax_of_node is tax2)|| (node_type is 2 and tax_of_node is tax1)
     return TRUE;
  else return FALSE;
}

Not the exact code. Follow the logic. Try something like this and it should work.

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