How to realize that only specific users can download attachments on form?

Shirley7
Tera Contributor

There is a function at top of forms,users can use it to manage attachment.

Shirley7_0-1679887943308.png

 

I want to realize that only specific user(such as assign to )can download files.(It is also ok to not display the entire function )

How should I do?Please help me,please~

2 ACCEPTED SOLUTIONS

Hari Prasath
Tera Guru

Hi @Shirley7 ,

 

You can achieve this by writing a read ACL on the sys_attachment table.

 

if(current.table_name=="your_table_name")

{

if(gs.getUser().isMemberOf('your_group name'))

{

answer =true;

}

else

{

answer=false

}

}

 

Please mark the answer as helpful, if it helped you accordingly.

 

Thanks,

Hari

View solution in original post

Ratnakar7
Mega Sage
Mega Sage

HI @Shirley7 ,

 

To restrict the download of attachments on a form to specific users, you can use Access Control Rules (ACRs). Here's how you can do it:

  1. Navigate to the sys_attachment table.
  2. Create a new Access Control Rule.
  3. Set the following conditions in the ACR:
  • Operation: read
  • Role: [specific role(s) that can download attachments]
  • Advanced: [add a condition to limit access to attachments assigned to a specific user or group] ,the condition would be something like "assigned_to=javascript:gs.getUserID()".
  1. Save the ACR.

If my response helps you to resolve the issue close the question by Accepting solution and hit 👍thumb icon. From Correct answers others will get benefited in future.

 

Thanks,

Ratnakar

View solution in original post

5 REPLIES 5

Hari Prasath
Tera Guru

Hi @Shirley7 ,

 

You can achieve this by writing a read ACL on the sys_attachment table.

 

if(current.table_name=="your_table_name")

{

if(gs.getUser().isMemberOf('your_group name'))

{

answer =true;

}

else

{

answer=false

}

}

 

Please mark the answer as helpful, if it helped you accordingly.

 

Thanks,

Hari

Ratnakar7
Mega Sage
Mega Sage

HI @Shirley7 ,

 

To restrict the download of attachments on a form to specific users, you can use Access Control Rules (ACRs). Here's how you can do it:

  1. Navigate to the sys_attachment table.
  2. Create a new Access Control Rule.
  3. Set the following conditions in the ACR:
  • Operation: read
  • Role: [specific role(s) that can download attachments]
  • Advanced: [add a condition to limit access to attachments assigned to a specific user or group] ,the condition would be something like "assigned_to=javascript:gs.getUserID()".
  1. Save the ACR.

If my response helps you to resolve the issue close the question by Accepting solution and hit 👍thumb icon. From Correct answers others will get benefited in future.

 

Thanks,

Ratnakar

Thanks for your reply,it works!!

Thank you very much!!

FathimuthuB
Tera Contributor

@Shirley7 ACL is not working for me. How did it worked for you?