Restricting deleting attachments

rjp
Tera Expert

Hi Guru's

Just wondering if its possible to restrict deleting attachments to the person who created the attachement AND all admins?

So the only ones that can delete the attachement from a RITM is the user that attached the file and all admins.

I have the admin restriction in place but just need help with the user that created the attachement.

Let me know what you think.

Thanks in advance.

Robert

1 ACCEPTED SOLUTION

That is not correct/recommended. You need to either edit the delete ACL or create a business rule on sys_attachment table before delete. Business rule route is easy



When: before delete


Conditions: Table is sc_req_item //if you only want to have this rule in place for request item table


Script:


if(!gs.hasRole('admin') || !(current.sys_created_by==gs.getUser().getEmail())){


current.setAbortAction(true);


}


View solution in original post

7 REPLIES 7

Hi Abhinay,


Thanks again for your help with this, why is my approach to this problem not correct or recommended.


It seems to yield the correct results.


Thanks again.


Robert


Abhinay Erra
Giga Sage

By inactivating all the ACL's, you are taking all the OOB logic out of the equation. Rather you can create a business rule I have provode or edit those OOB acls to check for the table name is request item and write your logic in that if condition


I did activate an ACL and added the following code...i didn't add any code for the admin but i wonder if the 'admin overrides' property allowed admins to delete.


find_real_file.png


I also added this condition to a UI Action, presumably to allow the delete function to appear in the dropdown?



find_real_file.png


Thank you again for your help with this!


Rob