function hook_webform_update_access in Webform 7.4
Overrides the node_access and user_access permissions.
Overrides the node_access and user_access permission to access and edit webform components, e-mails, conditions, and form settings.
Return NULL to defer to other modules. If all implementations defer, then access to the node's EDIT tab plus 'edit webform components' permission determines access. To grant access, return TRUE; to deny access, return FALSE. If more than one implementation return TRUE/FALSE, all must be TRUE to grant access.
In this way, access to the EDIT tab of the node may be decoupled from access to the WEBFORM tab. When returning TRUE, consider all aspects of access as this will be the only test. For example, 'return TRUE;' would grant annonymous access to creating webform components, which seldom be desired.
Parameters
object $node: The Webform node to check access on.
object $account: The user account to check access on.
Return value
bool|null TRUE or FALSE if the user can access the webform results, or NULL if access should be deferred to other implementations of this hook or node_access('update') plus user_access('edit webform components').
See also
Related topics
1 invocation of hook_webform_update_access()
- webform_node_update_access in ./
webform.module - Menu access callback. Ensure a sure has access to update a webform node.
File
- ./
webform.api.php, line 729 - Sample hooks demonstrating usage in Webform.
Code
function hook_webform_update_access($node, $account) {
// Allow anyone who can see webform_editable_by_user nodes and who has
// 'my webform component edit access' permission to see, edit, and delete the
// webform components, e-mails, conditionals, and form settings.
if ($node->type == 'webform_editable_by_user') {
return node_access('view', $node, $account) && user_access('my webform component edit access', $account);
}
}