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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

How to get Bitbucket users from a JIRA Database

Is it possible, using Script Runner, to get all of the Bitbucket users, projects etc, that are synced with the JIRA Database?

Currently, all of my code returns null, I'm not if this is because of the JIRA Database and having no local users.


import com.atlassian.bitbucket.*;
import com.atlassian.bitbucket.user.ApplicationUser;
import com.atlassian.bitbucket.user.UserService
import com.atlassian.bitbucket.user.Person
import com.atlassian.sal.api.component.ComponentLocator;
import com.atlassian.bitbucket.user.UserAdminService
import com.atlassian.bitbucket.project.ProjectSupplier
import com.atlassian.bitbucket.util.PageRequest
import com.atlassian.bitbucket.project.ProjectService
import com.atlassian.bitbucket.util.PageRequestImpl

import com.atlassian.bitbucket.auth.AuthenticationContext
import java.util.*;
import org.apache.log4j.Level
import org.apache.log4j.Logger

def UserService userService = ComponentLocator.getComponent(UserService);

//File to be written to, can be CSV or TXT
File file = new File("/local/home/rbadmin_app2/plugin_output.txt")

def ProjectService projectService
def PageRequest pageRequest = new PageRequestImpl(0, 100);
def projectName = projectService.findAll()
ApplicationUser bitbucketUser

def bitbucketU = userService.findUsersByName("", pageRequest)

log.debug( bitbucketU.getValues() )

//Collection<ApplicationUser> bitbucketUser = new ArrayList<ApplicationUser>();

// userService.getUserByName("");
for(int i = 0; i <= bitbucketUser.size(); i++ ){
file.append( "" + userService.getUserByName("").toString() )

for(Iterator<Collection> iterator = bitbucketUser.iterator(); iterator.hasNext();){
for(int i = 0; i <= projectName.size(); i ++){
log.error projectName
//file.append("" + projectName )

0 answers

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events