Problem/Motivation

http://drupal.org/project/field_permissions is an awesome module for controlling who can see/use different fields by what role they are in. I would like to be able to do the same thing with Workbench Access sections.

If I use Field Permissions and Roles to control access to the different fields, I will end up with 100's of roles, and 1000's of checkboxes on the permissions page. Not something I want to deal with.

Comments

agentrickard’s picture

We would likely have the exact same problem with field-access per section.

Needs some UX love.

jerrac’s picture

Hmm... Field Permissions adds their form on the edit field page, WA could do the same.

These are the options from FP.
* Create field (edit on content creation).
* Edit field, regardless of content author.
* Edit field own on content created by the user.
* View field, regardless of content author.
* View own field on content created by the user.

Maybe each of them could have their own "box", and there'd be a "pool" of all the WA Sections. The the user could just drag whatever sections they want and drop them into the "boxes".

It could still get pretty big if you have lots of sections. But's better than having to deal with a role per section, which is what I'm looking at right now.

agentrickard’s picture

I wonder if we would want to piggyback on top of FP, as an optional extension module.

In any event, this would have to be a new module / submodule.

stevector’s picture

jerrac can you explain the use case a bit more? Is that that you have sections A, B, and C and fields field_foo and field_bar. And that you want only those users in sections A and B to be able to edit/view field_foo and only users in section B and C to edit/view field_bar?

jerrac’s picture

stevector, that's pretty much what I'm asking for.

If I have fields Jump, Run, and Sit, and sections Active and Passive for a Basic Page content type, then I want users in the Active section to only see Jump and Run, and users in the Passive section to only see Sit, but users in both sections should see all three fields.

My actual use case is a check box that makes a node appear in a block on the front page. I only want certain users to be able to use that check box, but I don't want to have to create a special content type for only those users.

robeano’s picture

What if you used organic groups for field_permissions control? I don't think that Workbench Access should dictate Access at the field level.

FAAREIA’s picture

you need field access control when you have 1 node with 10 fields, witch 4, are variable depending on the user.

use case: Private node, with 4 private fields like price, software, updates, circuit photo. Perhaps you have a user that must not see the software field, or the price field, or boths. Then you won't create 256 (4*4*4*4...it's a guess XD) roles....it's non-sense

are you still with that issue jerrac???
i have myself the same trouble and ended with a views php function and some fields on the user account profile.

jerrac’s picture

Haven't actually had time to work on it since I posted on this issue last. :\

FAAREIA’s picture

hi jerrac, i didn't understant too much your last post, but i think that with 3 roles you can handle that.

If you want to have checkboxes to hide / show certain fields, this is what i did.

I created 4 fields at the user profile, each field represents a field in, for example, content type "products".

This 4 user profile fields are "text list", and within is the name of each node of content type "products". (i didn't use nid because i have 2 languages and both have equal titles)

Then in views, i create a view for each node field, and check the current login user profile to show or hide (access granted / denied) the field. With this, you can manage the display of a field depending on the current user, and then on the current node.

Views has this php access code:

$nid = arg(1);
$node = node_load($nid);
$title = $node->title;

global $user;
$uid = user_load($user->uid);
$profile = profile2_load_by_user($uid, 'profile_machine_name');

$access = TRUE;
$contador = count($profile->field_to_check['und']);
$position = 0;

while ( $position <= $contador ) {
	if ( $title == $profile->field_to_check['und'][$position]['value'] ) {
		$position = $contador + 1;
		$access = FALSE;
	}
	else {
		$position++;
	}
}

return $access;

To access the field, it checks the user profile text list field (there are 4, one for every field, and each one have every node title of content ype "product")

hope it helps!!