microsoftgraph / microsoftgraph/msgraph-sdk-java
expand of appRoleAssignments on user get call yields no results
オープン
まだ誰も着手していません。
Needs: Attention :wave:
type:question
- 主要言語
- Java
- スター
- 444
- フォーク
- 154
- 平均マージ
- 18時間 28分
- マージ済み PR(30日)
- 4
説明
Describe the bug
I was trying to get a user together with it's appRoleAssignments in one call. The documentation is pointing out that the expand feature for appRoleAssignments is supported. But it doesn't work.
Expected behavior
I would expect the expand to return results.
How to reproduce
User user = graphClient.usersWithUserPrincipalName(username).get(
rc -> {
rc.queryParameters.select = new String[]{"id", "userPrincipalName", "displayName", "givenName", "surname", "accountEnabled"};
rc.queryParameters.expand = new String[]{"appRoleAssignments"};
}
);
or
graphClient.users().byUserId(username).get(
rc -> {
rc.queryParameters.select = new String[]{"id", "userPrincipalName", "displayName", "givenName", "surname", "accountEnabled"};
rc.queryParameters.expand = new String[]{"appRoleAssignments"};
}
);
SDK Version
6.22.0
Latest version known to work for scenario above?
No response
Known Workarounds
For now I have to write this code to get it done:
var user = graphClient.usersWithUserPrincipalName(username).get(
rc -> rc.queryParameters.select = new String[]{"id", "userPrincipalName", "displayName", "givenName", "surname", "accountEnabled"}
);
user.setAppRoleAssignments(getAllAppRoleAssignments(user.getId())); // an 'expand' of appRoleAssignments in the above call gave an empty array :| ...
return user;
private List<AppRoleAssignment> getAllAppRoleAssignments(String userId) {
var result = new ArrayList<AppRoleAssignment>();
var page = graphClient.users().byUserId(userId).appRoleAssignments().get();
while (page != null) {
result.addAll(Optional.ofNullable(page.getValue()).orElse(emptyList()));
var odataNextLink = page.getOdataNextLink();
if (StringUtils.isBlank(odataNextLink)) {
break;
} else {
page = graphClient.users().byUserId(userId).appRoleAssignments().withUrl(odataNextLink).get();
}
}
return result;
}
Debug output
Click to expand log
```</details>
### Configuration
_No response_
### Other information
_No response_
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、issue にある 2 つのユーザー GET 呼び出しを appRoleAssignments の expand 付きで再現し、それらのレスポンスを個別の appRoleAssignments リクエストと比較します。文書化されている expand の動作が Graph サービスと SDK バージョン 6.22.0 でサポートされているか確認します。結合したリクエストが期待される割り当てを返すか、制限が文書化されていれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- java
- 領域
- api
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 35/100