Tasks drag to re-order without task edit permission

otakikam - July 22, 2009 - 20:07
Project:Storm
Version:6.x-1.23
Component:Storm Task
Category:bug report
Priority:normal
Assigned:homoludens
Status:needs review
Description

Not sure if this is a bug, intentional, or an error on my installation.

When a user only has permission to view tasks of their organization they can still drag to re-order the tasks and save the changes.

It's not so much that I don't want my users re-ordering I just think it may add confusion. And this generally seems like an inconsistency in permissions.

Thanks

#1

otakikam - July 22, 2009 - 20:08
Title:Task drag to re-order without task edit permission» Tasks drag to re-order without task edit permission

#2

homoludens - July 28, 2009 - 12:22
Assigned to:Anonymous» homoludens

I agree with otakikam, and will look into this. Users should have as simple interface as possible.

#3

Magnity - July 28, 2009 - 13:34

Not regarding the simplicity issue - it is a bit inconsistent with the permissions, and there are several other places in Storm that happens which could do with fixing.

Would it be as simple as an if (edit permission) { click and drag function } else { standard table } ?

#4

homoludens - July 28, 2009 - 15:49

Should be something like that:

In function theme_stormtask_tasks (in stormtask.theme.inc) only this line is important to make rows draggable:

    $row['class'] = empty($row['class']) ? 'draggable' : $row['class'] .' draggable';

and in function stormtask_tasks_form (in stormtask.admin.inc) omitting this code will prevent user form saving.

  $form['submit'] = array(
    '#type' => 'submit',
    '#submit' => array('stormtask_tasks_submit'),
    '#value' => t('Save'),
  );

but that is only template side, there is more work to make it really secure. This two changes should fix presentation side but I searching how to really prevent (even malicious) users from modifying list.

Would it be enough to add check for permissions in function stormtask_tasks_submit (in stormtask.admin.inc) or it is enough not to show $form['submit'] ?

#5

Mark_Watson27 - July 28, 2009 - 17:02

Personally, I'd do both, i.e. add permission check for display and submit just to make sure.

#6

Magnity - August 4, 2009 - 23:21

Just to add an extra question - say a user has the permission 'edit own', how should this be handled for this purpose?

---

I'd like to solve this issue before the release of 6.x-1.24.

(See #540212: Testing of -dev version before 6.x-1.24 release)

#7

Magnity - August 10, 2009 - 11:31
Status:active» needs review

The issue that I mentioned previously relates to that if a user does not have a simple edit permission, it may be that the user is supposed to be allowed to be edit some nodes that are listed and not others. Therefore, in the attached patches, I have simply used the user_access('stormtask: edit all') rather than stormtask_user_access().

However - it does seem to be a bit of a hack method, which I don't like all that much (small changes all over the place).

AttachmentSize
stormtask_527870_admin_inc.patch 1.36 KB
stormtask_527870_theme_inc.patch 1.27 KB

#8

Magnity - August 14, 2009 - 12:53

Did anyone have any more thoughts on this one?

#9

Mark_Watson27 - August 14, 2009 - 13:11

As this only applies to a projects task, can we check permissions on the project instead of all tasks, i.e. if they're allowed to edit the project then they're allowed to re-order the tasks?

#10

Magnity - August 14, 2009 - 14:08

Sounds like it might be better.

In terms of the node and where the data is stored - we'd be bypassing the permissions by changing the weight and/or parent task fields when the user may not have permission to, but conceptually I guess those fields only have a relevance when seen together on the project.

 
 

Drupal is a registered trademark of Dries Buytaert.