Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

BambooUserManager getGroup(String) returns an empty list.

Hi,

I'm storing tuples of strings in the database (accessing via ActiveObjects).

One of the strings is the username of a bamboo user. When getting the membership of this user I usually call:

com.atlassian.user.User user = getBambooUserManager().getUser(userName);
Pager<Group> groups = getBambooUserManager().getGroups(user);

But sometimes it happens that this call will return an empty list.

 

When I then check using all known groups:

for(Group g : groups){
            System.out.println(g.getName());
            
            Pager<String> members = getBambooUserManager().getMemberNames(g);
            for(String m : members){
                User user = getBambooUserManager().getUser(m);
                System.out.println(user);
            }
        }

and iterating and checking the names of the member the affected user will be in that list of a certain group. But still calling

getBambooUserManager().getGroups(com.atlassian.user.User user)

will return an empty list.

The instance of BambooUserManager is always the same (a static reference in a class).

 

When I assign groups to the affected user and will double check this at /admin/user/viewUsers.action

everythings looks fine and need and the method getGroups(com.atlassian.user.User user) will return a list (or a pager) whith all assigned usergroups. When I then restart the bamboo server, the problem again occurs that the call of getGroups(User user) will return an empty list.

 

Best regards

Titus

1 answer

0 votes

Hi! 

 

have you fix it? 

I have met with the same issue. 

 

Cheers,

Gonchik Tsymzhitov

Hi Gonchik,

 

yeah I'm using now the method getMemberNamesAsList() because I can start with the group names. Propably it helps:

 

BambooUserManager bum = getBambooUserManager();

ArrayList _groupNames = new ArrayList<String>();

Pager<Group> pager = bum.getGroups();
        Collection<Group> page = pager.getCurrentPage();
        for (Group group : page) {
            _groupNames.add(group.getName());
        }

        while (!pager.onLastPage()) {
            pager.nextPage();
            page = pager.getCurrentPage();
            for (Group group : page) {
                _groupNames.add(group.getName());
            }
        }

for(String _groupName : _groupNames){

Group group = bum.getGroup(_groupName);
        List<String> userNamesAsList = bum.getMemberNamesAsList(group);



for (String username : userNamesAsList) {
            User u = bum.getUser(username);
        }

}

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bamboo

Bamboo Data Center - Early Access Program

G’day Bamboo customers, The wait is almost over! We are in the final stages of work on the first release of Bamboo Data Center, our self-managed enterprise offering of Bamboo. This Data Center offe...

974 views 0 16
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