junichi11/netbeans-backlog-plugin

Unable to get users when opening a task

DrSchranz opened this issue · 5 comments

getUsers method of the BacklogData class is receiving an exception from Backlog4j when opening IssuePanel, because is using "global" backlogClient.getUsers() method. I'm a normal user API Key, and seems that user list api endpoint is only for administrators and project administrators.
Browsing the API, i see another method /api/v2/projects/:projectIdOrKey/users and Backlog4j client has the method.
I have created a fork with the simple changes, that makes the plugin functional to normal users.
I 'm not familiar with github manners, my apologies if they are not correct.

Hello, I have to get used to GitHub before forking and pushing... Meanwhile this allows "Normal User" API Keys to get the users and open the Issues.

(nb80)

--- BacklogData.java (b6466e0)
+++ BacklogData.java (958f183)
@@ -214,7 +214,7 @@
             return Collections.emptyList();
         }
         if (users == null || isForce) {
-            users = backlogClient.getUsers();
+            users = backlogClient.getProjectUsers( repository.getProject().getId() );
         }
         return users;
     }

@DrSchranz Thanks for catching it! Never mind about your PR. I am to be blame because CONTRIBUTING.md file is not added... I'll add it later. PR is always welcome :) I'll apply your patch soon.
Please try sending a PR next time if you find an issue ;)

BTW, you can also use gist if you provide a patch.

Thanks.

Applied :) I changed only a bit.