When building a site for a client, we often use webform to build a contact form. We would like to allow the client to edit the usual node content at node/[nid]/edit, but restrict access to node/[nid]/webform and the underlying pages. I haven't looked at the code but I think adding a separate permission for this shouldn't be hard to do. Would you consider committing a patch, or is this a "won't fix"?

PS. Searching the webform issue queue for "permission" returns a lot of results, so forgive me if I missed an existing feature request.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quicksketch’s picture

This has been brought up before but I'm not sure if it's been as a feature request. My general feeling is that this is an unnecessary complication to introduce to the module. Worse, we'd need to re-implement all node access control systems that are already available to us. By using the same permission as the normal "Edit" permission, the Webform tab immediately works with all access control systems like Node Access, Taxonomy Access, and Organic Groups. All of these modules would need either special-casing for editing Webforms or an add-on module would be necessary (note that we already have a similar problem with the "Results" tab, which is why I had to create OG Webform).

marcvangend’s picture

Ouch, that sounds more complicated than I thought it would be. I'm not an expert on the node access system, obviously :-) I'd love to come up with creative and less complex solutions, but I just don't know enough about this subject. I guess it's time to reach for Pro Drupal Development this weekend...

quicksketch’s picture

Yeah I don't think this will make it into Webform directly, but you could create you own permission checks in a custom module by using hook_menu_alter() and hook_perm().

enkara’s picture

Just to let you know, I would love this functionality too!
Thank you

marcvangend’s picture

Status: Active » Postponed

I'll set this to postponed for now and see what I can come up with later, be it a separate module or a patch (less likely, as it seems).

Bartezz’s picture

Subscribing

Most of times my clients would like to edit the node (body, title, etc) but they don't have the know-how of editing forms. Therefore I'd like to give them the permission to only edit the node not the webform components or other webform settings.

A similar issue can be found here; http://drupal.org/node/775072
A good start for a patch can be found in the last post in the issue above.

Cheers

marcvangend’s picture

Status: Postponed » Closed (duplicate)

Bartezz, my use case is exactly like yours. Thanks for the link; I wonder why I didn't find it before. I'm marking this as duplicate of #775072: Add 'edit webforms' permission for attached webforms.

Bartezz’s picture

FileSize
923 bytes

For others bumping into this, I've attached a small module.
I've used the code http://drupal.org/node/775072 in a custom module myself.
But if you're not a coder or aren't using custom modules then the attachment might help you!

- Install module
- Enable 'edit own/any webform content' in admin/user/permissions under 'node module'
- Enable 'edit webform form settings' in admin/user/permissions under 'webform extra permissions' for users allowed to edit per node webform settings, like fields etc....

Cheers

undersound3’s picture

thanks for this module Bartezz

Bumped into a small issue though. Enabling this module will not work because it has an incorrect reference to the webform dependency because of the capital.

dependencies[] = Webform
should be
dependencies[]=webform

After that you are able to enable the module by checking the checkbox.

corrected version attached

Bartezz’s picture

Ah alright, didn't seem to have that problem myself or did and forgotten about it. Thanx for posting!

Cheers

clemens.tolboom’s picture

Tnx to @Bartezz and @undersound3 I converted their module to a D7 version.

Note that @quicksketch mentioned in #775072: Add 'edit webforms' permission for attached webforms this fix bypasses node access so when using this module together with ie Organic allows for users with the new permission to edit all webforms.

I've added extra code in the other zip (http://drupal.org/files/webform_extra_permissions-D7-extra.zip) which test for 'update' permissions thus mitigates the Organic Group I hope. This needs testing.

function webform_extra_permissions_permission_check($node, $permission) {
  return node_access('update', $node) && user_access($permission);
}

/**
 * Implementation of hook_menu_alter().
 */
function webform_extra_permissions_menu_alter(&$items) {
  $items['node/%webform_menu/webform']['access callback'] = 'webform_extra_permissions_permission_check';
  $items['node/%webform_menu/webform']['access arguments'] = array(1, 'edit webform form settings');
}

I hope @quicksketch can shed a light on this too.

Anonymous’s picture

The workaround here worked perfectly for me (removed the webform tab, and if they try to navigate straight to the webform URL they get "You are not authorized to access this page."): http://drupal.org/node/775072#comment-3197810

mario.awad’s picture

Issue summary: View changes

The D7 module by @clemens.tolboom in comment #11 works well. No Organic Groups need so I couldn't test with that.

Question is, how do we make this awesome tiny module a proper contrib one so that we can update it in the future and our Drupal websites get its updates automatically?

I'm ready to help or even create the module, though I'm a beginner on this front.

Thanks.

Sting Hack’s picture

Sting Hack’s picture