#1966 closed enhancement (fixed)
The user that delete an item should see the item in the trashcan
Reported by: | Nicklas Nordborg | Owned by: | Nicklas Nordborg |
---|---|---|---|
Priority: | major | Milestone: | BASE 3.7 |
Component: | core | Version: | |
Keywords: | Cc: |
Description
The current trashcan functionality can only display items that the currently logged in user is the owner of.
If a user that is not the owner delete an item it will not show up in that user's trashcan. This is a bit annoying in a large project where different items are owned by different users but once in a while an administrator need to clean up something. The administrator typically has DELETE permission but then has to ask other users (or use the impersonate functionality) to empty the trashcans.
A workaround is to enable the 'removed' option in the 'view/presets' list and use the trashcan icon for each item. This may be okay for a few items, but not when deleting lots of items at the same time.
It would be nice if the user that deleted an item actually could see that item in the own trashcan.
A possible solution to this issue is to replace the boolean isRemoved
property of items with a nullable integer removedBy
property. Null values are the same as 'not removed' and non-null values is the id of the user that removed the item. When listing items in the trashcan we could simply include items which has owner=<id-of-current-user> OR removedBy=<id-of-current-user>
.
For existing items with the removed flag set we simply set removedBy=owner
.
Change History (6)
comment:1 by , 9 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 9 years ago
comment:3 by , 9 years ago
comment:4 by , 9 years ago
(In [7017]) References #1966: The user that delete an item should see the item in the trashcan
Defined filter ownedOrRemovedBy
that is used by the traschcan instead of the ownedBy
filter. This filter should return items that are either owner or removed by the current user.
Items that are ChildItem
:s or not Ownable
still require special handling. For child items we check the owner of the parent item. For items that are not ownable we only check if the user has delete permission or not (as before).
comment:5 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Seems like this is working now.
comment:6 by , 9 years ago
(In [7035]) References #1966: The user that delete an item should see the item in the trashcan
The database schema update need to happen in a different order. The installation will for example create new item subtypes and plug-ins for Kits. This will fail if the 'removed' column exists in the tables since it is defined as 'not null' and the new mapping doesn't include this column. The update that transfers the owner/root to the 'removed_by' column and then drops the 'removed' column must be done in the adjustExistingItems()
method so that the database is good to go for inserting new items after that.
(In [7015]) References #1966: The user that delete an item should see the item in the trashcan
Replaced
RemovableData.isRemoved()
withRemovableData.getRemovedBy()
. Existing classes has been updated to implement the new methods.The schema update will fix existing items that has been flagged for removal by setting the
removedBy
property to the owner or to the root user and then removed theremoved
column from all tables.Existing code that query the database has been updated to use
removedBy
instead ofremoved
.The trashcan still has the old functionality since we only check for NULL/NOT NULL.