Drupal <= 6 lacks node view permissions in core. Published node is visible to all roles and unpublished is visible only to node author and users with "administer nodes" permission. To implement simple role based view access one have to use contributed modules using grants table or create own module only to implement hook_access. After Dries call I decided to ask for a feature: view permissions in core for node types provided by node module.
Once I've modified drupal 6 node.module to introduce 'view @node_type content' and 'view own @node_type content' permissions. The patch is simple and works for mee. Please review the code and comment if this feature seems useful. I'll prepare the patch for Drupal 7-dev later.
| Comment | File | Size | Author |
|---|---|---|---|
| node_view_permissions.patch.txt | 1.08 KB | sin |
Comments
Comment #1
sin commentedActually there is "access content" permission to determine if role can access all node content. My patch only adds additional permissions to restrict view based on node type and leaves "access content" permission in place. User need both to view a node.
Comment #2
sin commentedIt overrides node_access table permissions now because patched node_content_access returns TRUE or FALSE on view :( There must be another way to restrict view before grants checking. Do not return FALSE in node_content_access()? Rename permissions to "restrict view" and "restrict view own" and only return FALSE in node_content_access()?
Comment #3
drewish commentedsubscribing... this has annoyed me for quite a while but now that everything is going towards CCK and core nodes it's becoming a bigger issue.
Comment #4
bsherwood commented+1
Subscribing!
Comment #5
capellicYes, I totally want this!
Comment #6
nneuman commentedDuplicate of issue #282404: Add view [TYPE] content permission
I'll mark this one as duplicate since there are actually some background explanations in the other issue that might be interesting for people if they pick this up again.
Comment #7
introfini commented+1
Subscribing!
Comment #8
Maaack commentedSubscribing.
Comment #9
LaurentAjdnik commentedSubscribing