1919import java .util .List ;
2020import java .util .Map ;
2121
22+ import com .cloud .utils .Pair ;
2223import org .apache .cloudstack .acl .ControlledEntity ;
24+ import org .apache .cloudstack .acl .RolePermissionEntity ;
2325import org .apache .cloudstack .acl .RoleType ;
2426import 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 ;
2530import org .apache .cloudstack .api .command .admin .account .CreateAccountCmd ;
26- import org .apache .cloudstack .api .command .admin .user .GetUserKeysCmd ;
27- import org .apache .cloudstack .api .command .admin .user .RegisterUserKeyCmd ;
28- import org .apache .cloudstack .api .command .admin .user .UpdateUserCmd ;
29- import org .apache .cloudstack .auth .UserTwoFactorAuthenticator ;
30- import org .apache .cloudstack .backup .BackupOffering ;
31- import org .apache .cloudstack .dns .DnsServer ;
3231
3332import com .cloud .dc .DataCenter ;
3433import com .cloud .domain .Domain ;
3736import com .cloud .offering .DiskOffering ;
3837import com .cloud .offering .NetworkOffering ;
3938import com .cloud .offering .ServiceOffering ;
40- import com .cloud .utils .Pair ;
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 ;
47+ import org .apache .cloudstack .auth .UserTwoFactorAuthenticator ;
48+ import org .apache .cloudstack .backup .BackupOffering ;
49+ import org .apache .cloudstack .dns .DnsServer ;
4150
4251public interface AccountService {
4352
@@ -98,7 +107,7 @@ User createUser(String userName, String password, String firstName, String lastN
98107
99108 void markUserRegistered (long userId );
100109
101- public String [] createApiKeyAndSecretKey (RegisterUserKeyCmd cmd );
110+ ApiKeyPair createApiKeyAndSecretKey (RegisterUserKeysCmd cmd );
102111
103112 public String [] createApiKeyAndSecretKey (final long userId );
104113
@@ -128,6 +137,8 @@ User createUser(String userName, String password, String firstName, String lastN
128137
129138 void validateAccountHasAccessToResource (Account account , AccessType accessType , Object resource );
130139
140+ void validateCallingUserHasAccessToDesiredUser (Long userId );
141+
131142 Long finalizeAccountId (String accountName , Long domainId , Long projectId , boolean enabledOnly );
132143
133144 /**
@@ -137,9 +148,15 @@ User createUser(String userName, String password, String firstName, String lastN
137148 */
138149 UserAccount getUserAccountById (Long userId );
139150
140- public Pair <Boolean , Map <String , String >> getKeys (GetUserKeysCmd cmd );
151+ Pair <Boolean , Map <String , String >> getKeys (GetUserKeysCmd cmd );
152+
153+ ListResponse <ApiKeyPairResponse > listKeys (ListUserKeysCmd cmd );
154+
155+ List <ApiKeyPairPermission > listKeyRules (ListUserKeyRulesCmd cmd );
141156
142- public Pair <Boolean , Map <String , String >> getKeys (Long userId );
157+ void deleteApiKey (DeleteUserKeysCmd cmd );
158+
159+ void deleteApiKey (ApiKeyPair id );
143160
144161 /**
145162 * Lists user two-factor authentication provider plugins
@@ -154,4 +171,13 @@ User createUser(String userName, String password, String firstName, String lastN
154171 */
155172 UserTwoFactorAuthenticator getUserTwoFactorAuthenticationProvider (final Long domainId );
156173
174+ ApiKeyPair getLatestUserKeyPair (Long userId );
175+
176+ ApiKeyPair getKeyPairById (Long id );
177+
178+ ApiKeyPair getKeyPairByApiKey (String apiKey );
179+
180+ String getAccessingApiKey (BaseCmd cmd );
181+
182+ List <RolePermissionEntity > getAllKeypairPermissions (String apiKey );
157183}
0 commit comments