2016-01-29 64 views
2

我正在使用遠程Rice 2.3.6(嵌入在Kuali Coeus 5.2.1中)作爲IAM後端的Grails應用程序。這很多方面都是成功的!但是,這個人是不是:返回Kuali Rice遠程API:removePrincipalFromRole無提示失敗

org.kuali.rice.kim.api.role.RoleService kimRoleServiceClient 

... 

kimRoleServiceClient.assignPrincipalToRole(
      principalId, 
      role.namespace, 
      role.name, 
      qualifiers) 

kimRoleServiceClient.principalHasRole(
      principalId, 
      [kimRoleServiceClient.getRoleIdByNamespaceCodeAndName(
       role.namespace, 
       role.name)], 
      qualifiers) // returns true, as expected 

kimRoleServiceClient.removePrincipalFromRole(
      principalId, 
      role.namespace, 
      role.name, 
      qualifiers) 

kimRoleServiceClient.principalHasRole(
      principalId, 
      [kimRoleServiceClient.getRoleIdByNamespaceCodeAndName(
       role.namespace, 
       role.name)], 
      qualifiers) // returns true (unexpected behavior) 

沒有錯誤,無論是作爲調用的結果或登錄到遠程KC catalina.out異常。我可以在KC UI中驗證角色是否仍然分配,並且這不是兩次調用之間的緩存問題 - 我可以等待相當長的時間,角色仍然分配。

任何線索?

編輯:

有人建議在rice.collab郵件列表,這個問題可能與KULRICE-9835: removePrincipalFromRole uses attribute id instead of attribute name in qualifier,爲固定水稻2.5.1被標記上。這可能會帶來進一步的障礙,但是目前這個呼叫即使對於沒有限定符的角色也是失敗的,即當上述呼叫中的qualifiers是空的Map時。

回答

2

您的編輯意見,你沒有通過限定符但是在這種情況下代碼拋出異常看代碼?這可能是你的問題嗎?

./rice-middleware/kim/kim-impl/src/main/java/org/kuali/rice/kim/impl/role/RoleServiceImpl.java

@Override 
    public void removePrincipalFromRole(String principalId, String namespaceCode, String roleName, 
      Map<String, String> qualifier) throws RiceIllegalArgumentException { 
     if (StringUtils.isBlank(principalId)) { 
      throw new RiceIllegalArgumentException("principalId is null"); 
     } 

     if (StringUtils.isBlank(namespaceCode)) { 
      throw new RiceIllegalArgumentException("namespaceCode is null"); 
     } 

     if (StringUtils.isBlank(roleName)) { 
      throw new RiceIllegalArgumentException("roleName is null"); 
     } 

     if (qualifier == null) { 
      throw new RiceIllegalArgumentException("qualifier is null"); 
     }... 
+0

如果是這樣的問題,第一次調用將失敗,Dan不會斷言第二次調用返回true。 –

+0

我傳遞了一個空的限定符Map(Groovy的'[:]'),而不是'null',所以我應該在這裏很好。我使用'assignPrincipalToRole'時沒有任何問題;我會編輯這個問題,使其更清晰。 –

+0

我不知道是誰投了答案,因爲它不正確?對不起肯,我錯過了丹的評論,第二個調用返回true,我不知道我怎麼知道這個調用是否通過了任何限定符,因爲它不是我正在處理的api調用。我可能完全錯過了你的觀點,但我只是看着代碼,並認爲它可能是基於評論的情況。 –