Closed (fixed)
Project:
Content Construction Kit (CCK)
Version:
6.x-2.x-dev
Component:
Content Permissions module
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
19 Nov 2008 at 02:40 UTC
Updated:
14 Jan 2009 at 13:50 UTC
Jump to comment: Most recent file
Comments
Comment #1
yched commentedHm, true, content_view_field() should probably be access aware. Maybe content_format() too, needs some thinking.
Problem is that our access checks are currently not too consistent :
- widgets visibility in node forms is done by content.module in content_field_form(), using hook_field_access()
- fields visibility in node view is done by content_permissions.module in its hook_nodeapi('view'), using hardcoded permission-based access rules.
- fields visibility in Views is done by content_permissions.module's content_views_access_callback(), using hardcoded permission-based access rules
I think it would be more consistent to reintegrate content_permissions_nodeapi() and content_views_access_callback() into content.module, and state that
- content.module takes care of access checks, through hook_field_access() calls.
- content_permissions.module simply provides one, permission-based, implementation of hook_field_access().
Moshe, what do you think ?
Comment #2
yched commentedAttached patch does what I described in #1 above (backport of what I recently committed in the 'Fields in D7 core' repository). I'd feel safer to have Moshe's review before committing to the D6 branch.
Comment #3
moshe weitzman commentedLooks like a good cleanup to me. I gave it a good read.
Comment #4
yched commentedCommitted the patch in #2.
Comment #5
yched commentedGoing back to tostinni's original request :
- content_view_field() automatically gained field-access check (since it's just a wrapper around the regular view op for a given field)
- I added a check for content_access('view') in content_format.
Comment #6
markfoodyburton commentedSurely this line should include the $op?
+ $field_access = module_invoke_all('field_access', $field, $account);
as in
+ $field_access = module_invoke_all('field_access', $op, $field, $account);
Or am I missing something?
Cheers
Mark.
Comment #7
yched commentedHem, surely indeed. Fixed.
Thanks.