You are here

function content_access_action_grant_node_permissions in Content Access 6

Same name and namespace in other branches
  1. 7 content_access_rules/content_access_rules.rules.inc \content_access_action_grant_node_permissions()

Action implementation: Grant permissions for a node.

1 string reference to 'content_access_action_grant_node_permissions'
content_access_action_set_node_permissions_upgrade in ./content_access.rules.inc
Automatically upgrade the old 'content_access_action_set_node_permissions' to an 'content_access_action_grant_node_permissions' action.

File

./content_access.rules.inc, line 92
Rules specific functions that expose content_access' API.

Code

function content_access_action_grant_node_permissions($node, $settings) {
  if (_content_access_rules_check_setting($node)) {
    $ca_settings = array();
    foreach (_content_access_get_operations() as $op) {
      $settings += array(
        $op => array(),
      );
      $ca_settings[$op] = array_keys(array_flip(content_access_per_node_setting($op, $node)) + array_flip($settings[$op]));
    }
    content_access_save_per_node_settings($node, $ca_settings);

    // A following node_save() updates the grants for us.
    return array(
      'node' => $node,
    );
  }
}