Hi,

I have created a view-page with a table. I have added the following fields:

  • Title
  • Weight
  • Weight selector

When I log in as an administrator I can drag and drop the rows in the table and save my changes (it works as intended). When I log in as a different user I can access the view and drag and drop the rows in the table. When I save however, the table reverts to its original form.

When I try to drag a row to a different place in the table I got the following javascript error in my browser:
TypeError: rowSettings is undefined.

Also the weight selector field is not being shown when you select show row weights when logged in as a different user. (screenshot 1: as admin, screenshot 2: as regular user)

I have also created a second user with administrator privileges, but I am having the same issue. It seems that the drag and drop functionality is only working when logged in as user/1

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Wim Vantomme created an issue. See original summary.

oinuma’s picture

Designation of privilege has been invoked in the "views/views_handler_weight_selector.inc" file.

$form[$this->options['id']][$row_index]['weight'] = array(
  '#type' => 'select',
  '#options' =>  $options,
  '#default_value' => $this->get_value($row),
  '#attributes' => array('class' => array('weight-selector')),
  '#access' => user_access('assign node weight'),
);

but it has not been set "hook_permission" the "weight.module" file.
So, to set the "hook_permission".

function weight_permission() {
  return array(
    'assign node weight' => array(
      'title' => t('Assign node weights'),
      'description' => t('Allow modification of node weights.'),
    ),
  );
}

Set the "assign node weight" the "/admin/people/permissions" page

nimek’s picture

This should be marked as critical and fixed ASAP !

@oinuma - thanks for solution

pagecarving’s picture

I used the code from #2 and it worked as stated.
@oinuma - thanks!

nimek’s picture

Title: Tabledrag in view not working for orther users » Tabledrag in view not working for orther users (hook_permissions not declared in module file)
Priority: Normal » Major

Updated issue status and title - soltion is posted in this thread.

ankur.addweb’s picture

Status: Active » Needs review
FileSize
473 bytes

Attached patch adds permision in module file as suggested by oinuma.

krina.addweb’s picture

Status: Needs review » Reviewed & tested by the community
nimek’s picture

Please be aware that #6 patch dont solve entire issue because user without permisson will still see handler without rendered weight form field that will cause same error and make a lot of confusion.

Solution should be that handler should be also hidden when user dont have permission to use weight module.

badrange’s picture

This issue actually seems to be fixed in the git/dev version of the module, in revision e7051c1f8c108006a8c2294d5a990ddefb3b321e, which closed #2674418

badrange’s picture

Status: Reviewed & tested by the community » Closed (duplicate)
Related issues: +#2674418: No assign node weight permission

This is fixed in the git/dev version of this module.