sudo87 commented on code in PR #12294:
URL: https://github.com/apache/cloudstack/pull/12294#discussion_r2634298777
##########
plugins/api/discovery/src/main/java/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java:
##########
@@ -280,12 +283,22 @@ public ListResponse<? extends BaseResponse> listApis(User
user, String name) {
ReflectionToStringBuilderUtils.reflectOnlySelectedFields(account,
"accountName", "uuid")));
}
- if (role.getRoleType() == RoleType.Admin && role.getId() ==
RoleType.Admin.getId()) {
- logger.info(String.format("Account [%s] is Root Admin, all
APIs are allowed.",
-
ReflectionToStringBuilderUtils.reflectOnlySelectedFields(account,
"accountName", "uuid")));
+ // Limit APIs on first login requiring password change
+ UserAccount userAccount =
accountService.getUserAccountById(user.getId());
+ Map<String, String> userAccDetails = userAccount.getDetails();
+ if (MapUtils.isNotEmpty(userAccDetails)) {
+ String needPwdChangeStr =
userAccDetails.get(UserDetailVO.PasswordChangeRequired);
+ if ("true".equalsIgnoreCase(needPwdChangeStr)) {
+ apisAllowed = Arrays.asList("login", "logout",
"updateUser", "listUsers", "listApis");
Review Comment:
listUsers API is required to get user details after successful login
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]