Hi, Alex.K of the User Relationships(UR) module developed a new addon UR module discussed here http://drupal.org/node/304317 that adds the ability for users to make cck fields in content profile visible or invisible based on their relationship with other users. This works on the core user profile page along with the patched version of content profile discussed here http://drupal.org/node/430220

However, when you use Panels 3 to override the core user profile and you add a cck field from the patched version of content profile into a panels 3 content region those visibility options are lost and the cck fields that should be hidden are still visible.

Is there anyway that this module can be integrated to work with Panels 3? For more info please see comment #10 & #11 here http://drupal.org/node/430220.

From what alex.k says it seems like the issue revolves around the fact that his module is based on node_view where as the panels 3 override of the user profile page is based on the user view. Is there any way to have the user view of Panels 3 accept the visibility parameters of alex.k's new UR addon module? As alex.k is not experienced much with Panels perhaps you can provide him with the assistance he needs in accomplishing this.

I believe the integration of these modules would prove to be invaluable to the drupal community and thank you for all of your work and contributions.

Comments

alex.k’s picture

FWIW the entry point for applying privacy controls in user_relationship_field_perms.module is

/**
 * Mark fields private if they are not accessible by viewing user
 *
 * @param unknown_type $node node to process - each field will be marked with "#access" => FALSE if it is inaccessible
 * @param unknown_type $viewer viewing user's object, or NULL if current user
 * @param unknown_type $unknown_viewer = set to TRUE to only let publicly visible fields, i.e. viewer is not known at this time (e.g. search indexing)
 */
function _user_relationship_field_perms_apply_access_control(&$node, $viewer = NULL, $unknown_viewer = FALSE) {
...
}

which operates on a node object. Thanks.

merlinofchaos’s picture

From what alex.k says it seems like the issue revolves around the fact that his module is based on node_view where as the panels 3 override of the user profile page is based on the user view.

It appears that the actual problem is that the fields content type doesn't perform a node_view but instead calls $output = content_view_field($field, $node); directly.

We can talk about this here, but ultimately I don't think that this is something that will be fixed in Panels, but needs to be fixed in CCK, where the field is being displayed, since that's supplying the plugin for the field. That said, the root cause is that CCK doesn't provide a good centralized access control mechanism.

How does this work for Views? CCK provides that data without calling node_view either, so clearly there is a secondary mechanism for providing access control. What mechanism is that?

alex.k’s picture

How does this work for Views? CCK provides that data without calling node_view either, so clearly there is a secondary mechanism for providing access control. What mechanism is that?

Thanks for bringing this up. Views has a hook_views_access_callback() for this purpose, which CCK implements in content_permissions.module:

/**
 *  The default field access callback. Remove inaccessible fields from Views.
 *
 * @see content_views_field_views_data().
 */
function content_views_access_callback($field) {
  return user_access('view '. $field['field_name']);
}

Unfortunately it doesn't supply information about the node, which is why it isn't always useful.

merlinofchaos’s picture

Ok, so your access restriction depends both upon the field, the viewer, and the actual node object? So simply calling content_access() would not be enough?

If this is the case, I think we may need to involve yched here and expand content_view_field() to allow this kind of restriction. content_view_field() is actually used with both Views and Panels, I believe, and it could be possible to kill two birds with one stone by simply adding a hook in there that could allow access to be denied there. The issue is that it still won't work nicely with content_access() which is the *real* problem -- content_access() doesn't use the node at all.

prdsp’s picture

Hi Merlin, can you take a look at my post #23 over here http://drupal.org/node/304317#comment-1606170 and tell me if the last paragraph would possibly work?

merlinofchaos’s picture

Status: Active » Postponed

Marking htis postponed until the CCK side of this is worked out. I'm not at all sure what to do there and am going to leave that up to CCK experts.

Letharion’s picture

Status: Postponed » Closed (won't fix)

This issue is incredibly old, with no real progress for a really long time. With most people having turned their eye's to D7 now, I'm closing this issue. If you have a real need for this, you are free to open it, preferably pointing to relevant CCK discussion.