Skip to content

Commit 88df2e8

Browse files
resume PR
1 parent 493852d commit 88df2e8

File tree

13 files changed

+18
-41
lines changed

13 files changed

+18
-41
lines changed

api/src/main/java/com/cloud/user/AccountService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ User createUser(String userName, String password, String firstName, String lastN
138138
*/
139139
UserAccount getUserAccountById(Long userId);
140140

141-
public Pair<Boolean, Map<String, String>> getKeys(GetUserKeysCmd cmd);
141+
Pair<Boolean, Map<String, String>> getKeys(GetUserKeysCmd cmd);
142142

143143
ListResponse<ApiKeyPairResponse> listKeys(ListUserKeysCmd cmd);
144144

api/src/main/java/org/apache/cloudstack/acl/apikeypair/ApiKeyPairService.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,4 @@ public interface ApiKeyPairService {
2424
ApiKeyPair findByApiKey(String apiKey);
2525

2626
ApiKeyPair findById(Long id);
27-
28-
void validateCallingUserHasAccessToDesiredUser(Long userId);
2927
}

api/src/main/java/org/apache/cloudstack/api/BaseAsyncCmd.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ public abstract class BaseAsyncCmd extends BaseCmd {
2929
public static final String migrationSyncObject = "migration";
3030
public static final String snapshotHostSyncObject = "snapshothost";
3131
public static final String gslbSyncObject = "globalserverloadbalancer";
32-
public static final String apiKeySyncObject = "apikey";
3332
public static final String user = "user";
3433

3534
private Object job;

api/src/main/java/org/apache/cloudstack/api/command/admin/user/DeleteUserKeysCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import org.apache.cloudstack.api.response.SuccessResponse;
3030

3131
@APICommand(name = "deleteUserKeys", description = "Deletes a keypair from a user", responseObject = SuccessResponse.class,
32-
since = "4.21.0", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
32+
since = "4.23.0", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
3333
public class DeleteUserKeysCmd extends BaseAsyncCmd {
3434

3535
@ACL

api/src/main/java/org/apache/cloudstack/api/command/admin/user/GetUserKeysCmd.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,22 @@
3838
responseHasSensitiveInfo = true,
3939
authorized = {RoleType.User, RoleType.Admin, RoleType.DomainAdmin, RoleType.ResourceAdmin},
4040
since = "4.10.0")
41-
4241
public class GetUserKeysCmd extends BaseCmd {
43-
4442
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = UserResponse.class, required = true, description = "ID of the user whose keys are required")
4543
private Long id;
4644

47-
48-
public Long getId(){
45+
public Long getId() {
4946
return id;
5047
}
5148

52-
public long getEntityOwnerId(){
49+
public long getEntityOwnerId() {
5350
User user = _entityMgr.findById(User.class, getId());
5451
if (user != null) {
5552
return user.getAccountId();
5653
}
5754
return Account.ACCOUNT_ID_SYSTEM;
5855
}
56+
5957
public void execute() {
6058
Pair<Boolean, Map<String, String>> keys = _accountService.getKeys(this);
6159

api/src/main/java/org/apache/cloudstack/api/command/admin/user/ListUserKeyRulesCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
responseObject = BaseRolePermissionResponse.class,
4141
requestHasSensitiveInfo = false,
4242
responseHasSensitiveInfo = false,
43-
since = "4.21.0")
43+
since = "4.23.0")
4444

4545
public class ListUserKeyRulesCmd extends BaseListDomainResourcesCmd {
4646

api/src/main/java/org/apache/cloudstack/api/command/admin/user/ListUserKeysCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
requestHasSensitiveInfo = false,
3838
responseHasSensitiveInfo = true,
3939
authorized = {RoleType.User, RoleType.Admin, RoleType.DomainAdmin, RoleType.ResourceAdmin},
40-
since = "4.21.0")
40+
since = "4.23.0")
4141

4242
public class ListUserKeysCmd extends BaseListDomainResourcesCmd {
4343

api/src/main/java/org/apache/cloudstack/api/response/UserResponse.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ public class UserResponse extends BaseResponse implements SetResourceIconRespons
132132
@Param(description = "the secret key of the user", isSensitive = true)
133133
private String secretKey;
134134

135-
136135
@Override
137136
public String getObjectId() {
138137
return this.getId();

engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade42010to42100.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@
1919
import com.cloud.upgrade.SystemVmTemplateRegistration;
2020
import com.cloud.utils.db.TransactionLegacy;
2121
import com.cloud.utils.exception.CloudRuntimeException;
22-
import java.sql.PreparedStatement;
23-
import java.sql.SQLException;
22+
2423
import java.io.InputStream;
2524
import java.sql.Connection;
25+
import java.sql.PreparedStatement;
26+
import java.sql.SQLException;
2627
import java.util.List;
2728

2829
import org.apache.cloudstack.framework.config.ConfigKey;

engine/schema/src/main/resources/META-INF/db/schema-42010to42100.sql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.host_pod_ref', 'storage_access_group
8282
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.data_center', 'storage_access_groups', 'varchar(255) DEFAULT NULL COMMENT "storage access groups for the hosts in the zone"');
8383

8484

85-
-- Create user token_keypairs table for apikey/secretkey tokens
85+
-- Create "api_keypair" table for api and secret keys
8686
CREATE TABLE IF NOT EXISTS `cloud`.`api_keypair` (
8787
`id` bigint(20) unsigned NOT NULL auto_increment,
8888
`uuid` varchar(40) UNIQUE NOT NULL,
@@ -101,10 +101,10 @@ CREATE TABLE IF NOT EXISTS `cloud`.`api_keypair` (
101101
CONSTRAINT `fk_api_keypair__user_id` FOREIGN KEY(`user_id`) REFERENCES `cloud`.`user`(`id`),
102102
CONSTRAINT `fk_api_keypair__account_id` FOREIGN KEY(`account_id`) REFERENCES `cloud`.`account`(`id`),
103103
CONSTRAINT `fk_api_keypair__domain_id` FOREIGN KEY(`domain_id`) REFERENCES `cloud`.`domain`(`id`)
104-
);
104+
);
105105

106106
CREATE TABLE IF NOT EXISTS `cloud`.`api_keypair_permissions` (
107-
`id` bigint(20) unsigned NOT NULL auto_increment,
107+
`id` bigint(20) unsigned NOT NULL auto_increment,
108108
`uuid` varchar(40) UNIQUE,
109109
`sort_order` bigint(20) unsigned NOT NULL DEFAULT 0,
110110
`rule` varchar(255) NOT NULL,
@@ -113,7 +113,7 @@ CREATE TABLE IF NOT EXISTS `cloud`.`api_keypair_permissions` (
113113
`description` varchar(255),
114114
PRIMARY KEY (`id`),
115115
CONSTRAINT `fk_keypair_permissions__api_keypair_id` FOREIGN KEY(`api_keypair_id`) REFERENCES `cloud`.`api_keypair`(`id`)
116-
);
116+
);
117117

118118
INSERT INTO `cloud`.`api_keypair` (uuid, user_id, domain_id, account_id, api_key, secret_key, created, name)
119119
SELECT uuid(), user.id, account.domain_id, account.id, user.api_key, user.secret_key, now(), 'Active key pair'

0 commit comments

Comments
 (0)