So this may be a very specific use case, but I'm trying to allow editable fields on a view that lists organic group wiki pages.

The user has permission to edit the node(s) because they are members of the group, editable fields appear for the individual node for the user, but they do not appear on the views listing of these nodes. In case you were wondering the user DOES have permission to edit all of the fields.

If I login as admin, or give the user the "edit any " permission then the editable fields appear on the view and all is well, but that breaks the OG functionality and allows the user to edit ANY of those nodes not just those that belong to their group.

I feel like this is a permission issue and I tried looking around at the different node_access statements, but can't seem to figure out why editablefields thinks the user doesn't have permission on the 'views' page but that they DO have permission on the individual node page.

Comments

ymmatt’s picture

OK, so I found the problem.

In editablefields.module on line 95 access permissions are checked.

  if (!node_access('update', $node) || !content_access('edit', $field)) {

The problem is that they are checked against the wrong type of element if viewing a views page. This may not make sense, but if you are viewing a "node" page the $node = $element['#node']; statement works when using node_access.

However, when you are viewing a views page it is a list of nodes and node_access isn't the right check

I made a quick and dirty change just to make it work (tested to see if it was a view and allowed access it)

//access is different if on a views page
$views_page = views_get_page_view();
if (is_object($views_page)) {
  $nodeAccess = TRUE;
}
else $nodeAccess = node_access('update', $node);

  // See if access to this form element is restricted,
  // if so, skip widget processing and just set the value.
  if (!nodeAccess || !content_access('edit', $field)) {

THIS IS NOT a good solution. I will likely refine it but thought I would share where/what the problem is in case anyone else came across this issue and wanted to start working on a solution before I was able to get to it.

dzigman’s picture

I've just experienced a similar issue with 6.22, views 3.0. Links to editable fields (comments) dropped out when in page view. My workaround was to create a block for the view and insert the block into a region on the page (theme Fusion). The links appeared in the block on the page and worked. Note: I did not make changes to the module, and og nodes were not involved.

joelpittet’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

Closing this to triage the queue. Feel free to comment if you'd like this to be re-opened, though currently there is nobody supporting the 6.x branch.