You are here

README.txt in Nodetype access 7

Nodetype access
===============
A node access module that doesn't use the node grants system, but instead uses
Drupal 7's new hook_node_access() and hook_query_alter().

Authors
=======
based on webchick's "Super Simple Access II Turbo Edition"
http://drupal.org/sandbox/webchick/1074988
with some minor fixes and improvements by axel.rutz

EFQ access control submodule
============================
If you do not know what EFQ is, just ignore it. Nodetype access works out of the box for you.

Nodetype access EFQ implements hook_entity_query_alter() to limit any EntityFieldQuery (EFQ).
Unpatched drupal 7.x node.module does not use EFQ to query nodes.
To use EFQ with views see http://drupal.org/project/efq_views

Playing with EFQ access control
===============================
# put this in your devel/php box to see EFQ query altering in action.
# you may want to set the "view [TYPE]" permission first.
# see also test cases

$query = new EntityFieldQuery();

$query = $query
  ->entityCondition('entity_type', 'node')
  ->entityCondition('bundle', array('page','article'), 'in')
  ;

dsm($query);

$result = $query
  ->execute();

dsm($query);
# notice that now $query->entityConditions['bundle'] has changed

dsm($result);

EFQ core bug
============

There is a minor core bug in EFQ, see http://drupal.org/node/1426702

File

README.txt
View source
  1. Nodetype access
  2. ===============
  3. A node access module that doesn't use the node grants system, but instead uses
  4. Drupal 7's new hook_node_access() and hook_query_alter().
  5. Authors
  6. =======
  7. based on webchick's "Super Simple Access II Turbo Edition"
  8. http://drupal.org/sandbox/webchick/1074988
  9. with some minor fixes and improvements by axel.rutz
  10. EFQ access control submodule
  11. ============================
  12. If you do not know what EFQ is, just ignore it. Nodetype access works out of the box for you.
  13. Nodetype access EFQ implements hook_entity_query_alter() to limit any EntityFieldQuery (EFQ).
  14. Unpatched drupal 7.x node.module does not use EFQ to query nodes.
  15. To use EFQ with views see http://drupal.org/project/efq_views
  16. Playing with EFQ access control
  17. ===============================
  18. # put this in your devel/php box to see EFQ query altering in action.
  19. # you may want to set the "view [TYPE]" permission first.
  20. # see also test cases
  21. $query = new EntityFieldQuery();
  22. $query = $query
  23. ->entityCondition('entity_type', 'node')
  24. ->entityCondition('bundle', array('page','article'), 'in')
  25. ;
  26. dsm($query);
  27. $result = $query
  28. ->execute();
  29. dsm($query);
  30. # notice that now $query->entityConditions['bundle'] has changed
  31. dsm($result);
  32. EFQ core bug
  33. ============
  34. There is a minor core bug in EFQ, see http://drupal.org/node/1426702