drupal的权限系统ACL

  • Node access modules always GRANT access and never restrict it. (It is a whitelisting rather a blacklisting system.) If you use two node access modules and one grants access while another does not, access is granted. This may be backwards from what some people would assume and is the reason why it is tricky to get involved with multiple node access modules. It is possible to use multiple node access modules in harmony however if for example they are applied to different content types or are giving out different grant types.
  • The four types of possible grants on a node are: view, update, create, and delete. You can use Devel module’s devel_node_access to analyze a node’s node access grants. (Doing so as a non-developer is a good sign that you’ve gotten into trouble with your node access modules and may need to follow the above advice!)

Drupal的权限使用的是一个白名单而不是黑名单,所以一旦用户被授权某项权限,就无法在其他模块进行限制。

但是有人做了对节点权限限制的尝试

http://blog.davereid.net/content/restricted-content-yet-another-different-drupal-node-access-module

1. hide core bulid form elements in drupal like author revision
use hook_form_alter
$form['revision_information']['#attributes'] = array(‘class’ => ‘hideme’); // Revision information
$form['author']['#attributes'] = array(‘class’ => ‘hideme’); // Author information
$form['options']['#attributes'] = array(‘class’ => ‘hideme’); // Publishing options
$form['xmlsitemap']['#attributes'] = array(‘class’ => ‘hideme’); // XML sitemap
$form['print']['#attributes'] = array(‘class’ => ‘hideme’); // Printer, e-mail and PDF versions
$form['path']['#attributes'] = array(‘class’ => ‘hideme’); // URL path settings
$form['menu']['#attributes'] = array(‘class’ => ‘hideme’); // Menu settings
then add the .hideme css in your theme style.css
also
in you can do this in the way $form['log']['#access'] = FALSE;
2. hide CCK build field
define $form['#after_build'][] = ‘_***_build’; in hook_form_alter function
and
in function _***_build()
{
unset($form['field_***_view']);//hide cck field

}
use #after_build
3. hide title and tags in drupal form
use hook_form_alter
//hide title
$form['title']['#type'] = ‘value’;
$form['title']['#required'] = FALSE;
//hide tags
$form['taxonomy']['tags'][4]['#type'] = ‘value’;
$form['taxonomy']['tags'][4]['#required'] = FALSE;

drupal疑难小问题总结

1.针对node部署权限 http://drupal.org/project/content_access /acl

2CCK input form or other form elements

HowTo: Theme a CCK input form
http://drupal.org/node/101092

form 也可以使用template (*.tpl.php)
http://www.joetsuihk.com/form_templates

contemplate 模块

3.drupal和dz整合 http://drupalchina.org/node/1169

4. http://blog.sina.com.cn/shengsongx

5. widget to edit User Lists in Forms API

http://www.angrydonuts.com/a_widget_to_edit_user_lists_in_f 大牛的博客

http://www.saurik.com/