taskadapter / redmine-java-api

Redmine Java API
Apache License 2.0
270 stars 163 forks source link

User.GetMemberships returns 0 items #328

Open emiliogq opened 5 years ago

emiliogq commented 5 years ago

Hi,

I am using GetCurrentUser() method to obtain the current and logged user. But when I tried to get all memberships I realized it did not return any item at all.

An used user example is attached. Some fields were removed for security reasons.

The following code shows the issue:

RedmineManager mgr = RedmineManagerFactory.createWithUserAuth(this.URI, username, password);
UserManager umgr = mgr.getUserManager();
                try {
            User u = umgr.getCurrentUser().
                        Collection<Membership> mc = u.getMemberships();
                        System.out.println(mc.size()); // Prints 0
        } catch (RedmineException e) {
            throw new AuthenticationException(e);
        }

I've tested this code using several URIs such as http://www.hostedredmine.com/

Thanks in advance

current_modified.zip

alexeyOnGitHub commented 4 years ago

I would suggest trying this on your own Redmine instance. please check that this is not a permissions problem