I am writing an event listener using ScriptRunner Listeners in Jira. The listener catches a specific update to an issue, and I need to add the user to a specific group, update an issue field which can only be edited by users in that group, then remove the user from the group. Since the user is not an administrator, I "execute" curl on the server to make a REST API call where I can pass in admin username/password to add the user to the group. This works, but the event listener does not realize the user has been added to the group (I can use GroupManager and see that the user is not listed in the group after the REST API call returns). So I am figuring the user context with permissions is not dynamically updated and remains the same as when the listener was invoked in the first place.
Is there a way to force a re-read of the user's permissions in the listener? And remember, the user is not an admin so it needs to be a function that any user can invoke.
Thanks,
-Greg