Commit 4ba3fc3f authored by quicksketch's avatar quicksketch

Issue #1123732 by kaare: Add parameter to filefield_edit_access() to

allow per-node field access.
parent ef333744
......@@ -539,13 +539,13 @@ function filefield_filefield_icon_sets() {
}
/**
* Access callback for the JavaScript upload and deletion AHAH callbacks.
* Access callback for AHAH upload/delete callbacks and node form validation.
*
* The content_permissions module provides nice fine-grained permissions for
* us to check, so we can make sure that the user may actually edit the file.
*/
function filefield_edit_access($type_name, $field_name) {
if (!content_access('edit', content_fields($field_name, $type_name))) {
function filefield_edit_access($type_name, $field_name, $node = NULL) {
if (!content_access('edit', content_fields($field_name, $type_name), NULL, $node)) {
return FALSE;
}
// No content permissions to check, so let's fall back to a more general permission.
......
......@@ -559,7 +559,7 @@ function filefield_node_form_validate($form, &$form_state) {
}
}
if (!$valid && $field['required'] && filefield_edit_access($field['type_name'], $field_name)) {
if (!$valid && $field['required'] && filefield_edit_access($field['type_name'], $field_name, $form['#node'])) {
form_set_error($field_name, t('%title field is required.', array('%title' => $field['widget']['label'])));
}
$max_filesize = parse_size($field['widget']['max_filesize_per_node']);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment