Skip to content

Commit d183dd0

Browse files
author
Nicole Schmidt
committed
fix retrocompatibility issue with getUserKeys
1 parent c13d060 commit d183dd0

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

server/src/main/java/com/cloud/user/AccountManagerImpl.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3126,12 +3126,11 @@ public Pair<Boolean, Map<String, String>> getKeys(GetUserKeysCmd cmd) {
31263126
keyPair = _accountService.getLatestUserKeyPair(userId);
31273127
}
31283128

3129-
validateKeyPairIsNotNull(keyPair);
3130-
validateAccessingKeyPairPermissionsIsSupersetOfAccessedKeyPair(keyPair, cmd);
3131-
31323129
Map<String, String> keys = new HashMap<>();
3133-
keys.put("apikey", keyPair.getApiKey());
3134-
keys.put("secretkey", keyPair.getSecretKey());
3130+
if (keyPair != null && isAccessingKeypairSuperset(keyPair, cmd)) {
3131+
keys.put("apikey", keyPair.getApiKey());
3132+
keys.put("secretkey", keyPair.getSecretKey());
3133+
}
31353134

31363135
Boolean apiKeyAccess = user.getApiKeyAccess();
31373136
if (apiKeyAccess == null) {

0 commit comments

Comments
 (0)