function webform_service_submission_access in Webform Service 6.3
Same name and namespace in other branches
- 7.4 webform_service.module \webform_service_submission_access()
Determine whether the current user has access to a submission.
1 string reference to 'webform_service_submission_access'
- _submission_resource_definition in resources/
submission_resource.inc - The submission resource definition.
File
- ./
webform_service.module, line 25 - Webform service module.
Code
function webform_service_submission_access($op = 'view', $args = array()) {
// Check to make sure they always have a UUID.
if (empty($args[0])) {
return services_error(t('Must provide a uuid.'), 404);
}
// The create submission access check.
if ($op == 'create') {
// Get the webform provided the UUID.
if (is_array($args[0]) || is_object($args[0])) {
$webform = (object) $args[0];
}
else {
if (in_array(gettype($args[0]), array(
'string',
'integer',
))) {
$webform = webform_service_resource_load($args[0]);
}
}
// If they can access the node view, then they can create a submission.
$webform = webform_node_view($webform, 'node');
return empty($webform['#enabled']);
}
else {
// Get the webform and submission from the uuid.
$webform = webform_submission_uuid_webform($args[0]);
$submission = webform_submission_uuid_get_submission($args[0]);
return webform_submission_access($webform, $submission, $op);
}
}