summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Haug2011-04-27 16:14:06 -0600
committerNathan Haug2011-04-27 16:14:06 -0600
commit4ba3fc3f2342bbd51f5e405e38fa077dfec96f18 (patch)
tree8a8468165e8ac84590247e64a700ef216826f045
parentef3337444639924a3642c89d3ac69680265bca51 (diff)
Issue #1123732 by kaare: Add parameter to filefield_edit_access() to
allow per-node field access.
-rw-r--r--filefield.module6
-rw-r--r--filefield_widget.inc2
2 files changed, 4 insertions, 4 deletions
diff --git a/filefield.module b/filefield.module
index d565e21..976544b 100644
--- a/filefield.module
+++ b/filefield.module
@@ -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.
diff --git a/filefield_widget.inc b/filefield_widget.inc
index eda6d76..b640c07 100644
--- a/filefield_widget.inc
+++ b/filefield_widget.inc
@@ -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']);