@Test public void a_user_having_no_role_and_updated_as_user_and_owner__has_role_owner_and_user() { AuthUser user = new AuthUser(); when(authUserRepository.findOrFail("user")).thenReturn(user); serviceToTest.updateRoles("user", new LinkedHashSet<>(Arrays.asList(RoleConstants.ROLE_OWNER, RoleConstants.ROLE_USER))); assertTrue(user.isRoleUser()); assertTrue(user.isRoleOwner()); assertFalse(user.isRoleSuperAdmin()); }
@UseCaseAdministratorAssignsUserToProject(@Step(number=4,next={Step.NO_NEXT_STEP} ,name="Roles changed in auth", description="Authorization layer adds ROLE_USER")) @UseCaseAdministratorUnassignsUserFromProject(@Step(number=4,next={Step.NO_NEXT_STEP} ,name="Roles changed in auth", description="Authorization layer removes ROLE_USER")) public void updateRoles(String userId, Set<String> roles) { assertion.isValidUserId(userId); internalUpdateRoles(userId, roles,0); }
AuthUserUpdateRolesService { @UseCaseAdministratorAssignsUserToProject(@Step(number=4,next={Step.NO_NEXT_STEP} ,name="Roles changed in auth", description="Authorization layer adds ROLE_USER")) @UseCaseAdministratorUnassignsUserFromProject(@Step(number=4,next={Step.NO_NEXT_STEP} ,name="Roles changed in auth", description="Authorization layer removes ROLE_USER")) public void updateRoles(String userId, Set<String> roles) { assertion.isValidUserId(userId); internalUpdateRoles(userId, roles,0); } }
AuthUserUpdateRolesService { @UseCaseAdministratorAssignsUserToProject(@Step(number=4,next={Step.NO_NEXT_STEP} ,name="Roles changed in auth", description="Authorization layer adds ROLE_USER")) @UseCaseAdministratorUnassignsUserFromProject(@Step(number=4,next={Step.NO_NEXT_STEP} ,name="Roles changed in auth", description="Authorization layer removes ROLE_USER")) public void updateRoles(String userId, Set<String> roles) { assertion.isValidUserId(userId); internalUpdateRoles(userId, roles,0); }  }
AuthUserUpdateRolesService { @UseCaseAdministratorAssignsUserToProject(@Step(number=4,next={Step.NO_NEXT_STEP} ,name="Roles changed in auth", description="Authorization layer adds ROLE_USER")) @UseCaseAdministratorUnassignsUserFromProject(@Step(number=4,next={Step.NO_NEXT_STEP} ,name="Roles changed in auth", description="Authorization layer removes ROLE_USER")) public void updateRoles(String userId, Set<String> roles) { assertion.isValidUserId(userId); internalUpdateRoles(userId, roles,0); }  @UseCaseAdministratorAssignsUserToProject(@Step(number=4,next={Step.NO_NEXT_STEP} ,name="Roles changed in auth", description="Authorization layer adds ROLE_USER")) @UseCaseAdministratorUnassignsUserFromProject(@Step(number=4,next={Step.NO_NEXT_STEP} ,name="Roles changed in auth", description="Authorization layer removes ROLE_USER"))/* @formatter:on */ void updateRoles(String userId, Set<String> roles); }
AuthUserUpdateRolesService { @UseCaseAdministratorAssignsUserToProject(@Step(number=4,next={Step.NO_NEXT_STEP} ,name="Roles changed in auth", description="Authorization layer adds ROLE_USER")) @UseCaseAdministratorUnassignsUserFromProject(@Step(number=4,next={Step.NO_NEXT_STEP} ,name="Roles changed in auth", description="Authorization layer removes ROLE_USER")) public void updateRoles(String userId, Set<String> roles) { assertion.isValidUserId(userId); internalUpdateRoles(userId, roles,0); }  @UseCaseAdministratorAssignsUserToProject(@Step(number=4,next={Step.NO_NEXT_STEP} ,name="Roles changed in auth", description="Authorization layer adds ROLE_USER")) @UseCaseAdministratorUnassignsUserFromProject(@Step(number=4,next={Step.NO_NEXT_STEP} ,name="Roles changed in auth", description="Authorization layer removes ROLE_USER"))/* @formatter:on */ void updateRoles(String userId, Set<String> roles);  }