anteo / redmine_custom_workflows

Allows to create custom workflows for Redmine
http://www.redmine.org/plugins/custom-workflows
GNU General Public License v2.0
182 stars 72 forks source link

Delete ISSUE depend in status #268

Closed ashrafalzyoud closed 2 years ago

ashrafalzyoud commented 2 years ago

if group admin id [ 1,2,3]

can delete issue for all status

if group users id [4.5.6]

can delete issue depend in status_id [ 7.8.9] cant delete issue depend in status_id [ 10.11.12]

ashrafalzyoud commented 2 years ago

The aim from my question to allow user delete issue if status new But when change the status can't delete it

AirTibu commented 2 years ago

Hi,

Add this code to BEFORE DESTROYING section:


if [10,11,12].include?(status_id) 

    unless Group.find(1).user_ids.include?(user.id) || Group.find(2).user_ids.include?(user.id)  || Group.find(3).user_ids.include?(user.id)

      errors.add(:base,"You are not authorized to delete this issue in this status")
      return true
    end
end

If user is NOT in any admin groups, then got an error message, when try to delete the issue in status 10,11,12.