Howdy...

Filefield Paths currently throws an error on fields in which the user doesn't have field edit access. (As set via CCK's Field Permissions module or any other module doing hook_field_access()) Basically info on those fields will still be available via content_types() however values won't be in the 'presave' $node array.

Attached patch fixes it unless you have a better idea :)

CommentFileSizeAuthor
filefield-paths-access.patch631 bytesMoonshine

Comments

deciphered’s picture

Status: Needs review » Postponed (maintainer needs more info)

Hi Moonshine,

Out of curiosity, is this a 6.x or 5.x issue? I know the version is set to 6.x-1-x-dev, but I can't seem to find information about a 6.x port of the CCK Field Permisions module.

If it is a 6.x issue, can you let me know where I can get a 6.x port?

Cheers,
Deciphered.

Moonshine’s picture

Status: Postponed (maintainer needs more info) » Needs review

It should just be a 6.x issue. CCK in 6.x comes with a module called "Content Permissions" that allows for role based, field by field, edit and view permissions. So there may be fields present in a content type that a given user doesn't have access to, and therefore won't show up in the presave $node.

CCK in 6.x also allows for other modules to control field level access directly through hook_field_access(). It's really a great addition, but because of it you just can't count on every field in content type to be present in $node for save.

deciphered’s picture

How right you are, clearly I was looking in the wrong place.

Look into this issue now.

deciphered’s picture

Status: Needs review » Postponed (maintainer needs more info)

Have looked into it and have not been able to reproduce as of yet.

Can you provide me with a a step-by-step process to reproduce the issue?

Moonshine’s picture

Yep.. actually it's a little more bizarre then I first thought, as it seems to come after a couple "edits" of a node that has a *multiple value imagefield and access permissions. (Which is making me question if filefield/imagefield (or possibly cck) has a multi-value bug with access permissions, as the value changes)

In any event, to reproduce here is what I did:

- Started with a fresh Drupal 6.4 db
- Enabled CCK, Content Permissions, Filefield/Imagefield, token, imageapi, Filefield Path
- Create a dummy user and give them permissions to create, edit and delete "story" type content
- Add "field_images" imagefield to "story" as a multi-value imagefield (must be 2+, not single value)
- Login as "dummy" user and create a story node. (no error)
- as "dummy" user, edit the story node -- say add something to body (no error)
- as "dummy" user, edit the story node again -- say add more to the body (error will appear)

It's important that authenticated users don't have edit permissions to field_images, so that the "dummy" user doesn't have field_images on their form for creation/editing. If you output the value of $node->$field['field_name'] during the above scenario you'll see how it changes.

I'll take a peek at things more tomorrow as it does seem odd how the value changes after a couple edits. The patch certainly works around it, but still...

deciphered’s picture

Status: Postponed (maintainer needs more info) » Active

Hi Moonshine,

Thanks for the info, I managed to reproduce the issue.
You're patch looks good and it (or something very similar) will be committed to HEAD sometime soon.

As for the cause of the issue itself, I will repost this issue to FileField and hopefully we can get to the bottom of the issue.

deciphered’s picture

Status: Active » Closed (fixed)

Committed to head