Take cck userreference on node in to grant user field?

clarkburbidge - January 23, 2009 - 04:29
Project:Nodeaccess
Version:HEAD
Component:Miscellaneous
Category:support request
Priority:normal
Assigned:Unassigned
Status:postponed (maintainer needs more info)
Description

Is there any way to get the user from the cck userreference field to be the user to be granted access. Maybe a rules module rule or workflow something or other?

#1

deviantintegral - February 11, 2009 - 01:32

I need this feature as well. In my use case, I need a user to be able to select another user in their content profile who has permission to edit and view their profile.

The way I would envision the feature is that if userreference is enabled, an additional checkbox would be enabled for that field / content type pair, along with the default permissions for that node type. You'd be able to overwrite it on a per-node basis as well just like the other permissions.

I'm going to investigate and probably start work on a patch.

#2

deviantintegral - February 11, 2009 - 22:50
Version:6.x-1.2» HEAD
Status:active» needs review

Here's a patch which implements this feature. It's entirely optional, and won't change anything if the userreference module isn't enabled.

It works by using the same data as the current per-user grants for a node. That way, if userreference is disabled, the permissions are still applied. As well, it means we don't have to change the database in any way. If the userreference field is changed, the previous user is deleted and the new user is inserted. If you have the grant tab enabled, you can modify the permissions from the default if needed, though they will be removed if the user reference field is changed.

Note that you do not need to enable the grant tab for this to work. Though if you do enable it, you will see the associated permissions for a user.

I've attached a screenshot of the UI change.

I'd appreciate testing on this feature so we can get it rolled in!

AttachmentSize
362981_userreference_integration.patch 10.82 KB
Nodeaccess User Reference Integration.png 52.91 KB

#3

deviantintegral - February 11, 2009 - 23:39

Updated patch which removes the default expanded setting for the fieldset which I was using while testing.

AttachmentSize
362981_userreference_integration_2.patch 10.76 KB

#4

deviantintegral - February 12, 2009 - 23:07

Updated patch which fixes a typo'ed call to variable_load() instead of variable_get().

AttachmentSize
362981_userreference_integration_3.patch 10.77 KB

#5

txcrew - February 23, 2009 - 23:16

I have found myself in need of this functionality, I will test out the patch now.

What happens when there are multiple users referenced?

txcrew

#6

chadcf - March 8, 2009 - 00:08
Status:needs review» fixed

Added, beta release should appear on the site soon.

#7

System Message - March 22, 2009 - 00:10
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

#8

joostvdl - June 17, 2009 - 15:31
Priority:normal» critical
Status:closed» active

Rebuilding of Access Rights does not add the correct settings in the database. And resaving a node does also not work if the referenced user isn't changed. So adding this module to an exisitng site and the use of rebuilding doesn't work.

Only newly created content types are added correctly to the access table.

#9

danielb - July 13, 2009 - 03:11

FYI, in response to the original post, there is already a project for this http://www.drupal.org/project/nodeaccess_userreference

#10

deviantintegral - July 13, 2009 - 15:10

@joostvdl can you provide more details? What you describe is exactly how I deployed the feature on my site, and it worked as expected.

#11

kenorb - July 16, 2009 - 16:11

#12

joostvdl - July 29, 2009 - 16:02

@deviantintegral : I have implemented another solution so I can't reproduce the issue anymore.

#13

deviantintegral - July 29, 2009 - 23:24
Priority:critical» normal
Status:active» postponed (maintainer needs more info)

Marking as postponed unless someone can replicate this.

 
 

Drupal is a registered trademark of Dries Buytaert.