Are there any plans of making a D7 Version? Or is there an alternative module which does this for 7?

Comments

epoitras’s picture

StatusFileSize
new8.32 KB

Here's an ugly fix I did to get it working with Drupal 7. I also added a few fixes discussed in the issue list. Was in the process of adding role based ACL when I decided I had defaced the module enough for now. I may come back to it later to finish off the role based ACL stuff.

epoitras’s picture

Oops my bad, this is the one.

piola’s picture

epoitras, can you please submit your code as an official commit so that it appears on the module's landing page. I am testing it, so far did not find any issues.

epoitras’s picture

Status: Active » Needs review
StatusFileSize
new13.66 KB

I don't have permission to submit the patch as an official commit, but here is a patch to be reviewed if Davy Van Den Bremt is still around.

beefheartfan’s picture

I did some testing on the patch today and I uncovered one issue.
If I attempted to add a user name that doesn't exist in my Drupal site I got the following error message along with the "Invalid User" error message:

Notice: Trying to get property of non-object in webform_submissions_acl_form_validate() (line 64 of C:\wamp\www\drupal7\sites\all\modules\webform_submissions_acl\webform_submissions_acl.pages.inc).

I corrected this by changing this code:

function webform_submissions_acl_form_validate($form, &$form_state) {
  $node_users = webform_submissions_acl_users_by_node($form_state['values']['nid'], TRUE);
  $account = array_shift(user_load_multiple(array(), array('name' => $form_state['values']['name'])));
  if (in_array($account->uid, $node_users)) {
    form_set_error('name', t('User is already added for this form'));
  }
  $account = array_shift(user_load_multiple(array(), array('name' => $form_state['values']['name'])));
  if (!$account) {
    form_set_error('name', t('Invalid user'));
  }
}

to this:

function webform_submissions_acl_form_validate($form, &$form_state) {
  $node_users = webform_submissions_acl_users_by_node($form_state['values']['nid'], TRUE);
  $account = array_shift(user_load_multiple(array(), array('name' => $form_state['values']['name'])));
  if (!$account) {
    form_set_error('name', t('Invalid user'));
  }
  else {
	if (in_array($account->uid, $node_users)) {
	  form_set_error('name', t('User is already added for this form'));
	}
  }
}
beefheartfan’s picture

Deleting users also didn't seem to work correctly for me. The $account variable was not being passed into the webform_submissions_acl_delete_confirm_form function until I made this update to the menu hook (I changed the page arguments to 4 instead of 5):

  $items['node/%webform_menu/acl/delete/%user'] = array(
    'title' => 'ACL',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('webform_submissions_acl_delete_confirm_form', 1, 4),
    'access callback' => 'node_access',
    'access arguments' => array('update', 1),
    'file' => 'webform_submissions_acl.pages.inc',
    'type' => MENU_CALLBACK,
  );
john.oltman’s picture

Issue summary: View changes
StatusFileSize
new14.01 KB

Here is a fresh patch that covers comments 4 through 6.