Active
Project:
Content push
Version:
6.x-1.0-alpha1
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
11 Jun 2011 at 19:08 UTC
Updated:
5 Jan 2012 at 18:20 UTC
Because there is no permission control for content push, the "Distribute" field form displays for ALL user from anonymous to admin on my sites. I handled it via a form-alter workaround, but strongly suggest adding permission control to the module.
Comments
Comment #1
joachim commentedYikes.
Could you make that form change in the module itself and post a patch?
Comment #2
wolv3rin3 commentedUnfortunately I'm a hack developer, Joachim, so I have no idea how to integrate with Drupal's permissions. But here's the snippets of what I did:
The form in question is
$form['content_push']which I found around line 46 in the content_push.moduleIn a Misc module specific to this site, I used form alter to only display the form for specific user roles, which is why it's just a workaround and not a true permission setting. My logic looked like:
if($user->uid==1 || in_array('nameofuserrole1', $user->roles) || in_array('nameofuserrole2', $user->roles))(make sure you call global $user prior to this)
---
Sorry I can't help more.
Comment #3
joachim commented> Unfortunately I'm a hack developer
Hehe, that's how most of us started :)
I won't be able to get to this till later in the week at the earliest, so if you wanted to dig in, what you need is two things:
- hook_perm() to define a permission name, say, 'push content to remote sites'.
- the user_access() function. This checks whether the current user has the given permission. (And no need to say global $user first!)
Happy hacking :)
Comment #4
wolv3rin3 commentedThanks for the boost in the right direction. Might not be able to get to it before you do, but you've given me enough pieces to get going.
OT: The integration with Features is saving me hours and hours of installation time. Thanks so much for adding that functionality.
Comment #5
joachim commented> OT: The integration with Features is saving me hours and hours of installation time. Thanks so much for adding that functionality.
Cool. Same here! :D
Comment #6
greta_drupal commentedAnd, please, don't keep that patch to yourself! :-) ...I am awaiting that functionality as well.
[not a php coder or drupal mod developer]
Comment #7
Ed Sawyer commentedDid this ever get rolled into the latest codebase? E.g. a permissions control? I could have a go at it if need be. It should be pretty straightforward.