Closed ashrafalzyoud closed 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
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.
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]