1
0
-1

Hello,

Some of my synced users are customers who have never gone into Jira or have any group. This breaks my exalate when in sycn with Jira software project, since they need permissions. I was trying to impersonate these users, but I am not sure if this code would be correct, can I check the group of the commenter?

if(replica.project.key == "IMPORTAL"){
   issue.projectKey   = "IM"
   issue.typeName     = nodeHelper.getIssueType(replica.typeName)?.name ?: "Incident"
      //issue.comments     = commentHelper.mergeComments(issue, replica, { comment -> comment.executor = comment.author})
   if (userHelper.isGroupMember(comment.author.username, "jira-users")){
       issue.comments     = commentHelper.mergeComments(issue, replica, { comment -> comment.executor = comment.author})
  
   }
   issue.comments     = commentHelper.mergeComments(issue, replica, { comment -> 
   comment.executor = nodeHelper.getUserByUsername("new.comment")
   comment.body = comment.author.displayName +" said : "+ comment.body   
})
}
    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      Hello, Lara LG
      Might I ask you to try

      if(replica.project.key == "IMPORTAL"){
         issue.projectKey   = "IM"
         issue.typeName     = nodeHelper.getIssueType(replica.typeName)?.name ?: "Incident"
            //issue.comments     = commentHelper.mergeComments(issue, replica, { comment -> comment.executor = comment.author})
         
         issue.comments     = commentHelper.mergeComments(issue, replica, { comment ->            def localAuthor = nodeHelper.getUserByEmail(comment.author.email)     if (localAuthor && userHelper.isGroupMember(localAuthor.username, "jira-users")){
             comment.executor = localAuthor
           } else {
             comment.executor = nodeHelper.getUserByUsername("new.comment")
             comment.body = comment.author.displayName +" said : "+ comment.body   
           }
         })
      }

      And let me know how it goes, please?
      Regards, Serhiy.

        CommentAdd your comment...