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.

CommentFileSizeAuthor
node_view_permissions.patch.txt1.08 KBsin

Comments

sin’s picture

Title: Node view permissions » Separate view permissions for each node type

Actually 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.

sin’s picture

Status: Needs review » Needs work

It 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()?

drewish’s picture

subscribing... 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.

bsherwood’s picture

+1

Subscribing!

capellic’s picture

Yes, I totally want this!

nneuman’s picture

Status: Needs work » Closed (duplicate)

Duplicate 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.

introfini’s picture

+1

Subscribing!

Maaack’s picture

Subscribing.

LaurentAjdnik’s picture

Subscribing