2121
2222import com .cloud .utils .Pair ;
2323import org .apache .cloudstack .acl .ControlledEntity ;
24+ import org .apache .cloudstack .acl .RolePermissionEntity ;
2425import org .apache .cloudstack .acl .RoleType ;
2526import org .apache .cloudstack .acl .SecurityChecker .AccessType ;
27+ import org .apache .cloudstack .acl .apikeypair .ApiKeyPair ;
28+ import org .apache .cloudstack .acl .apikeypair .ApiKeyPairPermission ;
29+ import org .apache .cloudstack .api .BaseCmd ;
2630import org .apache .cloudstack .api .command .admin .account .CreateAccountCmd ;
27- import org .apache .cloudstack .api .command .admin .user .GetUserKeysCmd ;
28- import org .apache .cloudstack .api .command .admin .user .RegisterUserKeyCmd ;
29- import org .apache .cloudstack .api .command .admin .user .UpdateUserCmd ;
3031
3132import com .cloud .dc .DataCenter ;
3233import com .cloud .domain .Domain ;
3536import com .cloud .offering .DiskOffering ;
3637import com .cloud .offering .NetworkOffering ;
3738import com .cloud .offering .ServiceOffering ;
39+ import org .apache .cloudstack .api .command .admin .user .DeleteUserKeysCmd ;
40+ import org .apache .cloudstack .api .command .admin .user .GetUserKeysCmd ;
41+ import org .apache .cloudstack .api .command .admin .user .ListUserKeyRulesCmd ;
42+ import org .apache .cloudstack .api .command .admin .user .ListUserKeysCmd ;
43+ import org .apache .cloudstack .api .command .admin .user .RegisterUserKeysCmd ;
44+ import org .apache .cloudstack .api .command .admin .user .UpdateUserCmd ;
45+ import org .apache .cloudstack .api .response .ApiKeyPairResponse ;
46+ import org .apache .cloudstack .api .response .ListResponse ;
3847import org .apache .cloudstack .auth .UserTwoFactorAuthenticator ;
3948import org .apache .cloudstack .backup .BackupOffering ;
4049
@@ -97,7 +106,7 @@ User createUser(String userName, String password, String firstName, String lastN
97106
98107 void markUserRegistered (long userId );
99108
100- public String [] createApiKeyAndSecretKey (RegisterUserKeyCmd cmd );
109+ ApiKeyPair createApiKeyAndSecretKey (RegisterUserKeysCmd cmd );
101110
102111 public String [] createApiKeyAndSecretKey (final long userId );
103112
@@ -125,6 +134,8 @@ User createUser(String userName, String password, String firstName, String lastN
125134
126135 void validateAccountHasAccessToResource (Account account , AccessType accessType , Object resource );
127136
137+ void validateCallingUserHasAccessToDesiredUser (Long userId );
138+
128139 Long finalizeAccountId (String accountName , Long domainId , Long projectId , boolean enabledOnly );
129140
130141 Long finalizeAccountId (Long accountId , String accountName , Long domainId , Long projectId );
@@ -136,9 +147,15 @@ User createUser(String userName, String password, String firstName, String lastN
136147 */
137148 UserAccount getUserAccountById (Long userId );
138149
139- public Pair <Boolean , Map <String , String >> getKeys (GetUserKeysCmd cmd );
150+ Pair <Boolean , Map <String , String >> getKeys (GetUserKeysCmd cmd );
151+
152+ ListResponse <ApiKeyPairResponse > listKeys (ListUserKeysCmd cmd );
140153
141- public Pair <Boolean , Map <String , String >> getKeys (Long userId );
154+ List <ApiKeyPairPermission > listKeyRules (ListUserKeyRulesCmd cmd );
155+
156+ void deleteApiKey (DeleteUserKeysCmd cmd );
157+
158+ void deleteApiKey (ApiKeyPair id );
142159
143160 /**
144161 * Lists user two-factor authentication provider plugins
@@ -153,4 +170,13 @@ User createUser(String userName, String password, String firstName, String lastN
153170 */
154171 UserTwoFactorAuthenticator getUserTwoFactorAuthenticationProvider (final Long domainId );
155172
173+ ApiKeyPair getLatestUserKeyPair (Long userId );
174+
175+ ApiKeyPair getKeyPairById (Long id );
176+
177+ ApiKeyPair getKeyPairByApiKey (String apiKey );
178+
179+ String getAccessingApiKey (BaseCmd cmd );
180+
181+ List <RolePermissionEntity > getAllKeypairPermissions (String apiKey );
156182}
0 commit comments