Node Privacy By Role has been a staple module for Drupal since 2004, allowing admins and content owners to fine tune the permissions for viewing, editing, and deleting nodes to specific user roles. It essentially creates a way to override the "access content" permission for nodes.

For a long time, scattered users have wanted even finer grained permissions for nodes. As part of the evolution of the module, this task will involve adding an option for users with the administer nodes permission to have checkbox options for view, edit, and delete with respect to the owner of the module. You will need to install and familiarize yourself with Node Privacy By Role.

Existing functionality

-+ Node Privacy by Role --------------------------
|                View       Edit      Delete     |
| Sales          |x|        |x|        | |       |
| Customer       |x|        |x|        | |       |
| Admin          |x|        |x|        |x|       |
--------------------------------------------------

Here salespeople and customers can view and edit, but not delete nodes. Admins can do all three.

New functionality

-+ Node Privacy by Role -------------------------
|                View       Edit      Delete    |
| Owner          |x|        | |        | |      |
|                                               |
|                View       Edit      Delete    |
| Sales          |x|        |x|        | |      |
| Customer       | |        | |        | |      |
| Admin          |x|        |x|        |x|      |
-------------------------------------------------

In this example, the salespeople would create a node to collaboratively view with customers. Though the customer role is not permitted to view the node, the salespeople would assign node ownership to the customer they want to view the node through the "Authored by:" field in the "Authoring information" fieldset on node creation. The salespeople, the customer/node author, and Admin would then be able to view the node.

Example 2

-+ Node Privacy by Role -------------------------
|                View       Edit      Delete    |
| Owner          | |        | |        | |      |
|                                               |
|                View       Edit      Delete    |
| Teacher        |x|        |x|        | |      |
| Student        |x|        |x|        | |      |
| Admin          |x|        |x|        |x|      |
-------------------------------------------------

In this example, the author of the node would have no access to the node, creating a sort of peer review situation. All other students would be able to view and edit the node, but the original author would not be able to until the Teacher re-enabled that access (assuming Teacher also has administer nodes permission).

The module addition should act as an explicit deny, meaning if the owner does not have permission to view, edit, or delete a node, but their role does, they may not be granted access to the node. This behavior is much in the same way as the original functionality of Node Privacy By Role (i.e. users must have privacy by role *and* global access content permissions to view a node).

For purposes of this issue, concentrate on comment #2 and totally ignore comment #4 on the original feature request on drupal.org. Create a module patch against the HEAD version of Node Privacy By Role to work with Drupal 6. Upload your patch to the original feature request at http://drupal.org/node/24073. When your patch is marked ready to be committed on drupal.org or is committed to CVS, upload a copy of the patch to this issue on google.com.

References
* Project homepage: http://drupal.org/project/node_privacy_byrole
* Handbook page: http://drupal.org/handbook/modules/node_privacy_byrole
* Forms API: http://api.drupal.org/api/file/developer/topics/forms_api.html

Contact: deekayen (http://drupal.org/user/972)

Expected time: 4 days

Comments

aclight’s picture

Status: Needs review » Reviewed & tested by the community

looks great to me.

deekayen’s picture

Title: Restrict node owner access through node_privacy_byrole » GHOP #103: Restrict node owner access through node_privacy_byrole
Status: Reviewed & tested by the community » Closed (fixed)
deekayen’s picture

Title: GHOP #103: Restrict node owner access through node_privacy_byrole » GHOP #104: Restrict node owner access through node_privacy_byrole

wrong number

deekayen’s picture

Title: GHOP #104: Restrict node owner access through node_privacy_byrole » Restrict node owner access through node_privacy_byrole

#google-ghop

aclight: deekayen: can you change the title of the issue that will be used for the task to say GHOP #104 instead of the task proposal issue. That way when we see it in the list of issues tagged with GHOP term it won't look like it's showing up by mistake.