Skip to content

Commit

Permalink
Add privileges for all data groups for default business functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Kwo Ding committed Feb 6, 2018
1 parent f7be5d8 commit 7486d69
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class AccessGroupsConfigurator {
private AccessGroupPresentationRestClient accessGroupPresentationRestClient = new AccessGroupPresentationRestClient();
private AccessGroupIntegrationRestClient accessGroupIntegrationRestClient = new AccessGroupIntegrationRestClient();

public void setupFunctionDataGroupAndAllPrivilegesAssignedToUserAndMasterServiceAgreement(LegalEntityByUserGetResponseBody legalEntity, String externalUserId, String functionName, String dataGroupId) {
public void setupFunctionDataGroupAndAllPrivilegesAssignedToUserAndMasterServiceAgreement(LegalEntityByUserGetResponseBody legalEntity, String externalUserId, String functionName, List<String> dataGroupIds) {
String functionGroupId = accessGroupPresentationRestClient.getFunctionGroupIdByLegalEntityIdAndFunctionName(legalEntity.getId(), functionName);

if (functionGroupId == null) {
Expand All @@ -43,11 +43,11 @@ public void setupFunctionDataGroupAndAllPrivilegesAssignedToUserAndMasterService
.withExternalUserId(externalUserId)
.withServiceAgreementId(null)
.withFunctionGroupId(functionGroupId)
.withDataGroupIds(Collections.singletonList(dataGroupId)))
.withDataGroupIds(dataGroupIds))
.then()
.statusCode(SC_OK);

LOGGER.info(String.format("Permission assigned for legal entity [%s], user [%s], service agreement [master], function group [%s], data group [%s]", legalEntity.getExternalId(), externalUserId, functionGroupId, dataGroupId));
LOGGER.info(String.format("Permission assigned for legal entity [%s], user [%s], service agreement [master], function group [%s], data groups %s", legalEntity.getExternalId(), externalUserId, functionGroupId, dataGroupIds));
}

public void ingestFunctionGroupsWithAllPrivilegesForAllFunctions(String externalLegalEntityId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
Expand Down Expand Up @@ -160,14 +161,14 @@ private void setupFunctionDataGroupAndPrivilegesUnderLegalEntity(LegalEntityByUs

switch (functionName) {
case SEPA_CT_FUNCTION_NAME:
accessGroupsConfigurator.setupFunctionDataGroupAndAllPrivilegesAssignedToUserAndMasterServiceAgreement(legalEntity, externalUserId, functionName, currencyDataGroup.getInternalEurCurrencyDataGroupId());
accessGroupsConfigurator.setupFunctionDataGroupAndAllPrivilegesAssignedToUserAndMasterServiceAgreement(legalEntity, externalUserId, functionName, Collections.singletonList(currencyDataGroup.getInternalEurCurrencyDataGroupId()));
break;
case US_DOMESTIC_WIRE_FUNCTION_NAME:
case US_FOREIGN_WIRE_FUNCTION_NAME:
accessGroupsConfigurator.setupFunctionDataGroupAndAllPrivilegesAssignedToUserAndMasterServiceAgreement(legalEntity, externalUserId, functionName, currencyDataGroup.getInternalUsdCurrencyDataGroupId());
accessGroupsConfigurator.setupFunctionDataGroupAndAllPrivilegesAssignedToUserAndMasterServiceAgreement(legalEntity, externalUserId, functionName, Collections.singletonList(currencyDataGroup.getInternalUsdCurrencyDataGroupId()));
break;
default:
accessGroupsConfigurator.setupFunctionDataGroupAndAllPrivilegesAssignedToUserAndMasterServiceAgreement(legalEntity, externalUserId, functionName, currencyDataGroup.getInternalRandomCurrencyDataGroupId());
accessGroupsConfigurator.setupFunctionDataGroupAndAllPrivilegesAssignedToUserAndMasterServiceAgreement(legalEntity, externalUserId, functionName, Arrays.asList(currencyDataGroup.getInternalRandomCurrencyDataGroupId(), currencyDataGroup.getInternalEurCurrencyDataGroupId(), currencyDataGroup.getInternalUsdCurrencyDataGroupId()));
}
});
}
Expand Down

0 comments on commit 7486d69

Please sign in to comment.