Show attachment only if user has specific role

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2022 05:59 AM
Hi There,
Can someone please suggest how to show the attachment for two tables if the user has a specific Role?
And if the user doesn't have this role they should not be able to see those table attachments.
Requirement: Two Tables (change & Problem)
Role: u_mgmt_user
Regards,
Priya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2022 06:04 AM
Hello Priya,
You will require an ACL on sys_attachment.
Read operation and condition: table name is problem or change_request
Plus the role.
Please give it a try and provide feedback.
Tudor

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2022 06:08 AM
Hey,
I did it but it's not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2022 06:08 AM
You can introduce a read ACL on sys_attachment table.
In the advanced scripting section you can have following script
getAttachmentReadAnswer();
function getAttachmentReadAnswer() {
// if table is change request and user has this role then this acl evaluates to true and attachments will be seen
if ((current.table_name == 'change_request'||current.table_name == 'problem' )&& gs.hasRole('u_mgmt_user'))
return true;
}
return false;
}