2014-09-19 70 views
1

我有一個小插件檢查幾件事情,如果拉請求描述包含有效的Jira票據等。Stash和Jira之間的訪問問題

以下代碼在Stash 3.2.4上測試時工作正常,但當我們將Stash升級到3.3.0(它可能不是導致插件仍在開發中的直接原因)後第二天停止工作。

public JiraServiceImpl(ApplicationLinkService applicationLinkService) 
{ 
    this.applicationLinkService = applicationLinkService; 
} 

private ApplicationLink getJiraApplicationLink() 
{ 
    ApplicationLink applicationLink = applicationLinkService.getPrimaryApplicationLink(JiraApplicationType.class); 

    if (applicationLink == null) 
    { 
     throw new IllegalStateException("Primary JIRA application link does not exist!"); 
    } 

    return applicationLink; 
} 

public boolean doesIssueExist(IssueKey issueKey) throws CredentialsRequiredException, ResponseException 
{ 
    checkNotNull(issueKey, "issueKey is null"); 


    final ApplicationLinkRequestFactory fac = getJiraApplicationLink().createAuthenticatedRequestFactory(); 

    ApplicationLinkRequest req = fac.createRequest(Request.MethodType.GET, "/rest/api/2/issue/"+issueKey.getFullyQualifiedIssueKey()); 

    return req.execute(new ApplicationLinkResponseHandler<Boolean>() 
    { 
     @Override 
     public Boolean credentialsRequired(Response response) throws ResponseException 
     { 
      throw new ResponseException(new CredentialsRequiredException(fac, "Token is invalid")); 
     } 

     @Override 
     public Boolean handle(Response response) throws ResponseException 
     { 
      return response.isSuccessful(); 
     } 
    }); 
} 

拋出異常與消息:「您沒有對遠程資源的授權訪問令牌」。

我沒有存儲管理權限,不能回到3.2.4。應用程序鏈接重新認爲是問題,但事實並非如此。進一步測試,我們看到它是爲那些擁有管理員權限的人工作的,但不是針對普通用戶的。

有什麼我可以改變來解決這個問題?

回答

0

由於我們只是在切換到GIT的過程中,我們沒有多少使用它,並沒有想到點擊JIRA問題,因爲我不需要測試應用程序鏈接(它正在測試中用戶)。

當我點擊提交列表中顯示的問題時,我有一個窗口要求我允許Stash和JIRA之間的讀寫權限。這樣做後,插件開始工作。我現在不得不爲兩個用戶做這件事,而且我希望在時間到了的時候,我不會爲他們每個人做這件事。

0

我建議與support.atlassian.com上的團隊聯繫以尋求幫助,這聽起來像是有一些關於您的應用程序鏈接不能按預期工作。

+0

我做了,幾乎在同一時間我在這裏問。他們的回答是,他們不處理髮展問題,並鼓勵我在answers.atlassian.com上提問。 – Amaranth 2014-09-23 17:43:03