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

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

Avatar

1 badge earned

Collect

Participate in fun challenges

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

Challenges
Coins

Gift kudos to your peers

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

Recognition
Ribbon

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!

Leaderboard

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
4,639,451
Community Members
 
Community Events
196
Community Groups

BambooUserManager getGroup(String) returns an empty list.

Titus
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Feb 08, 2018

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
Gonchik Tsymzhitov
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Jun 18, 2018

Hi! 

 

have you fix it? 

I have met with the same issue. 

 

Cheers,

Gonchik Tsymzhitov

Titus
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Jun 19, 2018

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
AUG Leaders

Atlassian Community Events