function content_access_action_user in Content Access 7
Process Rule's param, and grant by the passed operation.
2 calls to content_access_action_user()
- content_access_action_user_grant in content_access_rules/
content_access_rules.rules.inc - Action implementation: Grant user access.
- content_access_action_user_revoke in content_access_rules/
content_access_rules.rules.inc - Action implementation: Revoke user access.
File
- content_access_rules/
content_access_rules.rules.inc, line 357 - Rules specific functions that expose content_access' API.
Code
function content_access_action_user($params, $type) {
$ops = array(
'view',
'update',
'delete',
);
$settings = array();
$node = $params['node'];
foreach ($ops as $op) {
if ($params['content_access_user_' . $op]) {
$settings[$op] = $params['content_access_user_' . $op]->uid;
}
}
foreach ($settings as $op => $uid) {
$acl_id = content_access_get_acl_id($node, $op);
acl_node_add_acl($node->nid, $acl_id, (int) ($op == 'view'), (int) ($op == 'update'), (int) ($op == 'delete'), content_access_get_settings('priority', $node->type));
db_delete('acl_user')
->condition('acl_id', $acl_id)
->condition('uid', $uid)
->execute();
if ($type == 'grant') {
db_insert('acl_user')
->fields(array(
'acl_id' => $acl_id,
'uid' => $uid,
))
->execute();
}
}
content_access_action_aquire_grants($node);
}