function content_access_condition_check_permissions in Content Access 5
Same name and namespace in other branches
- 6 content_access.rules.inc \content_access_condition_check_permissions()
Condition implementation: Check if node has permissions.
@note This will only check for the existence of permissions, not the absence of. I.e. a rule that checks just for authenticated write will return TRUE for a node that allows authenticated and anonymous write.
File
- ./
content_access.workflow_ng.inc, line 115 - Workflow-ng specific functions that expose content_access's API.
Code
function content_access_condition_check_permissions($node, $settings) {
if (!content_access_get_settings('per_node', $node->type)) {
workflow_ng_handle_error_msg('Cannot check per-node permissions for ' . $node->type);
return FALSE;
}
// Compare our settings with node's settings.
foreach (array(
'view',
'update',
'delete',
) as $op) {
$expect_roles = $settings[$op];
$current_roles = content_access_per_node_setting($op, $node);
foreach ($expect_roles as $role) {
if (empty($current_roles[$role])) {
return FALSE;
}
}
}
return TRUE;
}