RE: Node access module (based on users listed in userreference fields)

By Benjamin Melançon
on 11 Dec
0 comments

Key words and phrases

userfield based permissions to content userreference linking

Tags

Description

I created a module (attached, in case you're curious) that's a user reference widget. When placed on a node type, it will hide itself and fill itself in from the URL with the person the request is being made of. When a node with the field on it is submitted, it emails the person.

What I need is a way to allow the user in the user reference field the same rights to the node as the author of the node. So for all access control, they should be treated the same.

Do you think that's something you can / want to do?

Thanks,

Michelle

[requestfield.zip]

Hi Michelle,

Woohoo!

This took me much longer than expected but then everything does. You can tell your client the World Social Forum was placed in jeopardy. But I desparately needed a completable task for a change!

I've tested the part you need pretty thoroughly, it was so much fun to toggle the options back and forth once it started working.

What I haven't tested that I'd appreciate if you could: multiple value userreference fields.

The other thing you didn't request that I haven't tested is the general access to all nodes under userreference access control.

The module is attached but I'll be putting it in CVS as soon as I can get to it.

Finally, I think it would be good if it did things like automatically recognized the presence of your module and set its userreference field and edit and view privileges accordingly, or provided hooks for your module to do this.

It would be a very simple hook, come to think of it-- a wrapper around the variable_set userreference_access uses. Feel free to add it!

I would appreciate if you could audit the code. Style, optimization, comments, help text, everything.

Which brings me to my last caveat: there's some funky static caching of the node IDs each user has access to. I think I covered every contingincy where this list should be updated, but if at any point the module displays, ah, unexpected behavior, this could be it.

Best,

benjamin

Agaric Design Collective
http://AgaricDesign.com/

 

Post new comment
The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote> <h1> <h2> <h3> <h4> <h5> <h6> <small> <pre> <strike> <sub> <sup> <kbd> <s>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Copy the characters (respecting upper/lower case) from the image.