Answer by Francis Martens (Exalate) on 14 February 2022
Check out
https://docs.idalko.com/exalate/display/ED/Attachments+synchronization
There is an example how you can iterate over the attachments, and only add them to the replica if these are meeting a number of conditions.
replica.attachments = issue.attachments.findAll { a ->
def publicComments = commentHelper.filterLocal(issue.comments)
def isMentionedInPublicComments = publicComments.any {
c -> c.body.contains("[^" + a.filename + "]") ||
(c.body =~ (/!${java.util.regex.Pattern.quote(a.filename)}(\|.*!|!)/.toString())).find()
}
isMentionedInPublicComments
}
Comments:
Madhu commented on 14 February 2022
Hello Francis Martens (iDalko)
We are using Exalate for Jira Software were we are using role based restriction for comments.
This is how the our Outgoing sync is configured for comments
replica.comments = issue.comments.findAll { it.roleLevel == “Both Internal & External” }
Could you please help us with the way to restrict attachments based on the roles.
For example Restrict all the attachments added to comments which is not synced.
Sync all the attachments added to the synced comments ( Both Internal & External Role ).
Thanks & Regards
Madhu
Francis Martens (Exalate) commented on 15 February 2022
Madhu,
Check following post
Attachment Restrictions (old community)
Madhu commented on 15 February 2022
Hi Francis Martens (Exalate) That is also me created a ticket year ago, stepped back without a proper solution.
Could you please check my error posted over there, Thanks for looking into.
Regards
Madhu
Alexander Hoff commented on 15 February 2022
Hi Francis - this query is a result of a customer escalation around securing their data. Please could this be treated as critical.
We are happy to jump on a call if this helps speeding up (possible) resolution.
Many thanks.
Francis Martens (Exalate) commented on 15 February 2022
Hi both,
Exalate is trying to indicate what the problem is
You will have to tweak the code a bit to make it work.
Francis
PS - In need of exalate configuration help? - 130 partner organisations are ready to help out.
Madhu commented on 17 February 2022
Hello Francis Martens (Exalate) Tried all the suggested answers still we are not able to restrict the attachments.
For the above code, even my shared attachments were not getting synced.
Thanks & Regards
Madhu
Francis Martens (Exalate) commented on 17 February 2022
Madhu,
Can you be more specific on the problem you encounter.
“It doesn’t work” is a too wide of a problem statement to be able to help.
Francis Martens (Exalate) commented on 20 February 2022
Madhu ^^^