Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Run behaviour as admin user


i have a field, which is populated by a behaviour.
The result shows all roles with members of the underlying project. The result is OK for any project administrators, but not for standard users (error in log for getting roles and members).
Is it possible to run the behviour under an admin user?

Best regards,

2 answers

2 accepted

1 vote
Answer accepted

No, because that would mean the client (the user's browser) would have to log in as an administrator.

0 votes
Answer accepted

@Harald Hiebl you could try setting the authenticated user to a service account user with the correct permissions.

You would need to make sure to set the authentication context back, whatever the outcome.

I haven't tried this with Behaviours specifically, but I have made use of this in workflows and other automations.

import com.atlassian.jira.component.ComponentAccessor

// get the Service Account user
def serviceAccount = ComponentAccessor.userManager.getUserByName('serviceaccount')

// get the currently logged in user
def currentUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser

// set the current user to the service account user

try {
// perform your processing as user with elevated permissions
} finally {
// make sure to reset the authentication context

Hello Gareth,

thank you very much - it works as expected


Like Gareth Cantrell likes this

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Apps & Integrations

🍻🍂Apptoberfest Update: Upcoming Virtual Events 🎉

Hello Community! I hope you've been enjoying the 🍂Apptoberfestivities🍂 (I know I have!) The event is heating up next week with a series of virtual events that we're calling the 🍻🍂Partner App ...

479 views 5 19
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you