expand of appRoleAssignments on user get call yields no results
まだ誰も着手していません。
評価
調査の方向性
まず、issue にある 2 つのユーザー GET 呼び出しを appRoleAssignments の expand 付きで再現し、それらのレスポンスを個別の appRoleAssignments リクエストと比較します。文書化されている expand の動作が Graph サービスと SDK バージョン 6.22.0 でサポートされているか確認します。結合したリクエストが期待される割り当てを返すか、制限が文書化されていれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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_
- 主要言語
- Java
- スター
- 444
- フォーク
- 154
- 平均マージ
- 18時間 28分
- マージ済み PR(30日)
- 4
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoftgraph/msgraph-sdk-java のほかの issue
-
status:waiting-for-triage type:bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
microsoftgraph/msgraph-sdk-java#2610 ·
-
status:waiting-for-triage type:bug
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
microsoftgraph/msgraph-sdk-java#2656 ·
-
status:waiting-for-triage type:bug
難易度 4/5 3〜5日 初心者へのやさしさ 38/100
microsoftgraph/msgraph-sdk-java#2654 ·
-
status:waiting-for-triage
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
microsoftgraph/msgraph-sdk-java#2639 ·
-
status:waiting-for-triage type:bug
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
microsoftgraph/msgraph-sdk-java#2589 · コメント 1 件 ·