有人可以解释“访问参数"吗?在 Drupal 中? [英] Can someone explain "access arguments" in Drupal?

查看:17
本文介绍了有人可以解释“访问参数"吗?在 Drupal 中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以解释 Drupal 中的访问参数"吗?相信我,我尝试过谷歌搜索,但我只是没有清楚地掌握.

Can someone explain "access arguments" in Drupal? Trust me I have tried Googling it but I am just not getting a clear grasp.

推荐答案

在/admin/user/permissions 中,您将看到许多访问选项.它们来自 drupal 模块,并允许站点管理员将特定权限分配给用户角色(默认情况下,drupal 提供匿名"和注册"角色).模块通过 hook_perm 声明它们,它们就像:

in /admin/user/permissions you will see lots of access options. they come from drupal modules, and lets the site administrator distribute specific permissions to user roles (drupal provides 'anonymous' and 'registered' roles by default). modules declare them through hook_perm and they are as easy to use as:

function mymodulename_perm {
return array('use custom feature', 'use the other custom feature');
}

它们会出现在那里,随时可以使用.现在,在您的任何功能中,您都可以通过 user_access 检查用户访问权限使用起来同样简单:

and they will show up there, ready to be used. now, in any function of yours, you can check for user access through user_access which is just as easy to use:

if (user_access('use custom feature')) {
  //do something
}

这篇关于有人可以解释“访问参数"吗?在 Drupal 中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆