@@ -1293,6 +1293,7 @@ public void createApiKeyAndSecretKeyTestWithEmptyRules() {
12931293 Mockito .when (userDaoMock .findById (any ())).thenReturn (userVoMock );
12941294 Mockito .when (_accountDao .findById (Mockito .anyLong ())).thenReturn (accountVoMock );
12951295 Mockito .doNothing ().when (accountManagerImpl ).checkAccess (Mockito .any (Account .class ), Mockito .isNull (), Mockito .anyBoolean (), Mockito .any (Account .class ));
1296+ Mockito .doNothing ().when (accountManagerImpl ).verifyCallerPrivilegeForUserOrAccountOperations (Mockito .any (User .class ));
12961297 Mockito .when (apiKeyPairDaoMock .findBySecretKey (Mockito .anyString ())).thenReturn (null );
12971298 Mockito .when (roleService .findAllPermissionsBy (Mockito .anyLong ())).thenReturn (List .of (
12981299 new RolePermissionVO (1L , "api2" , RolePermissionEntity .Permission .ALLOW , "description" )
@@ -1326,6 +1327,7 @@ public void createApiKeyAndSecretKeyTestPermissionNotPresentOnAccount() {
13261327 Mockito .when (userDaoMock .findById (any ())).thenReturn (userVoMock );
13271328 Mockito .when (_accountDao .findById (Mockito .anyLong ())).thenReturn (accountVoMock );
13281329 Mockito .doNothing ().when (accountManagerImpl ).checkAccess (Mockito .any (Account .class ), Mockito .isNull (), Mockito .anyBoolean (), Mockito .any ());
1330+ Mockito .doNothing ().when (accountManagerImpl ).verifyCallerPrivilegeForUserOrAccountOperations (Mockito .any (User .class ));
13291331 Mockito .when (roleService .findAllPermissionsBy (Mockito .anyLong ())).thenReturn (List .of (
13301332 new RolePermissionVO (1L , "api2" , RolePermissionEntity .Permission .ALLOW , "description" )
13311333 ));
@@ -1358,6 +1360,7 @@ public void createApiKeyAndSecretTestKeyDeniedOnAccount() {
13581360 Mockito .when (userDaoMock .findById (Mockito .anyLong ())).thenReturn (userVoMock );
13591361 Mockito .when (_accountDao .findById (Mockito .anyLong ())).thenReturn (accountVoMock );
13601362 Mockito .doNothing ().when (accountManagerImpl ).checkAccess (Mockito .any (Account .class ), Mockito .isNull (), Mockito .anyBoolean (), Mockito .any ());
1363+ Mockito .doNothing ().when (accountManagerImpl ).verifyCallerPrivilegeForUserOrAccountOperations (Mockito .any (User .class ));
13611364 Mockito .when (apiKeyPairDaoMock .findBySecretKey (Mockito .anyString ())).thenReturn (null );
13621365 Mockito .when (roleService .findAllPermissionsBy (Mockito .anyLong ())).thenReturn (List .of (
13631366 new RolePermissionVO (1L , "api" , RolePermissionEntity .Permission .DENY , "description" )
@@ -1392,6 +1395,7 @@ public void createApiKeyAndSecretKeyTestAllowedOnAccount() {
13921395 Mockito .when (userDaoMock .findById (Mockito .anyLong ())).thenReturn (userVoMock );
13931396 Mockito .when (_accountDao .findById (Mockito .anyLong ())).thenReturn (accountVoMock );
13941397 Mockito .doNothing ().when (accountManagerImpl ).checkAccess (Mockito .any (Account .class ), Mockito .isNull (), Mockito .anyBoolean (), Mockito .any (Account .class ));
1398+ Mockito .doNothing ().when (accountManagerImpl ).verifyCallerPrivilegeForUserOrAccountOperations (Mockito .any (User .class ));
13951399 Mockito .when (apiKeyPairPermissionsDaoMock .persist (Mockito .any (ApiKeyPairPermissionVO .class ))).thenReturn (permissionVO );
13961400 Mockito .doReturn (true ).when (roleService ).roleHasPermission (Mockito .any (), Mockito .any ());
13971401 Mockito .when (roleService .findRole (Mockito .anyLong ())).thenReturn (new RoleVO ());
@@ -1430,6 +1434,7 @@ public void createApiAndSecretKeyTestWithNonEmptyDates() {
14301434 Mockito .when (userDaoMock .findById (Mockito .anyLong ())).thenReturn (userVoMock );
14311435 Mockito .when (_accountDao .findById (Mockito .anyLong ())).thenReturn (accountVoMock );
14321436 Mockito .doNothing ().when (accountManagerImpl ).checkAccess (Mockito .any (Account .class ), Mockito .isNull (), Mockito .anyBoolean (), Mockito .any (Account .class ));
1437+ Mockito .doNothing ().when (accountManagerImpl ).verifyCallerPrivilegeForUserOrAccountOperations (Mockito .any (User .class ));
14331438 Mockito .when (apiKeyPairPermissionsDaoMock .persist (Mockito .any (ApiKeyPairPermissionVO .class ))).thenReturn (permissionVO );
14341439 Mockito .when (apiKeyPairDaoMock .findBySecretKey (Mockito .anyString ())).thenReturn (null );
14351440 Mockito .doReturn (true ).when (roleService ).roleHasPermission (Mockito .any (), Mockito .any ());
@@ -1473,6 +1478,7 @@ public void createApiAndSecretKeyTestWithExpiredDate() {
14731478 Mockito .when (userDaoMock .findById (Mockito .anyLong ())).thenReturn (userVoMock );
14741479 Mockito .when (_accountDao .findById (Mockito .anyLong ())).thenReturn (accountVoMock );
14751480 Mockito .doNothing ().when (accountManagerImpl ).checkAccess (Mockito .any (Account .class ), Mockito .isNull (), Mockito .anyBoolean (), Mockito .any (Account .class ));
1481+ Mockito .doNothing ().when (accountManagerImpl ).verifyCallerPrivilegeForUserOrAccountOperations (Mockito .any (User .class ));
14761482
14771483 ApiKeyPair response = accountManagerImpl .createApiKeyAndSecretKey (registerCmdMock );
14781484 Assert .assertEquals ((long ) response .getUserId (), userId );
@@ -1511,6 +1517,7 @@ public void createApiAndSecretKeyTestWithInvalidDate() {
15111517 Mockito .when (userDaoMock .findById (Mockito .anyLong ())).thenReturn (userVoMock );
15121518 Mockito .when (_accountDao .findById (Mockito .anyLong ())).thenReturn (accountVoMock );
15131519 Mockito .doNothing ().when (accountManagerImpl ).checkAccess (Mockito .any (Account .class ), Mockito .isNull (), Mockito .anyBoolean (), Mockito .any (Account .class ));
1520+ Mockito .doNothing ().when (accountManagerImpl ).verifyCallerPrivilegeForUserOrAccountOperations (Mockito .any (User .class ));
15141521
15151522 ApiKeyPair response = accountManagerImpl .createApiKeyAndSecretKey (registerCmdMock );
15161523 Assert .assertEquals (userId , (long ) response .getUserId ());
@@ -1552,6 +1559,7 @@ public void createApiAndSecretKeyTestWithMultipleAllowedPermissionsOneDenied() {
15521559 Mockito .when (userDaoMock .findById (Mockito .anyLong ())).thenReturn (userVoMock );
15531560 Mockito .when (_accountDao .findById (Mockito .anyLong ())).thenReturn (accountVoMock );
15541561 Mockito .doNothing ().when (accountManagerImpl ).checkAccess (Mockito .any (Account .class ), Mockito .isNull (), Mockito .anyBoolean (), Mockito .any (Account .class ));
1562+ Mockito .doNothing ().when (accountManagerImpl ).verifyCallerPrivilegeForUserOrAccountOperations (Mockito .any (User .class ));
15551563 Mockito .when (apiKeyPairDaoMock .findBySecretKey (Mockito .anyString ())).thenReturn (null );
15561564 Mockito .when (roleService .findAllPermissionsBy (Mockito .anyLong ())).thenReturn (List .of (
15571565 new RolePermissionVO (1L , "api1" , RolePermissionEntity .Permission .ALLOW , "description-1" ),
@@ -1597,6 +1605,7 @@ public void createApiAndSecretKeyTestWithMultipleAllowedPermissionsOneDoesNotExi
15971605 Mockito .when (userDaoMock .findById (Mockito .anyLong ())).thenReturn (userVoMock );
15981606 Mockito .when (_accountDao .findById (Mockito .anyLong ())).thenReturn (accountVoMock );
15991607 Mockito .doNothing ().when (accountManagerImpl ).checkAccess (Mockito .any (Account .class ), Mockito .isNull (), Mockito .anyBoolean (), Mockito .any (Account .class ));
1608+ Mockito .doNothing ().when (accountManagerImpl ).verifyCallerPrivilegeForUserOrAccountOperations (Mockito .any (User .class ));
16001609 Mockito .when (apiKeyPairDaoMock .findBySecretKey (Mockito .anyString ())).thenReturn (null );
16011610 Mockito .when (roleService .findAllPermissionsBy (Mockito .anyLong ())).thenReturn (List .of (
16021611 new RolePermissionVO (1L , "api1" , RolePermissionEntity .Permission .ALLOW , "description-1" ),
0 commit comments