Search in sources :

Example 16 with SysProvisioningBreakConfigDto

use of eu.bcvsolutions.idm.acc.dto.SysProvisioningBreakConfigDto in project CzechIdMng by bcvsolutions.

the class ProvisioningBreakProcessorTest method clearProvisioningBreakConfiguration.

/**
 * Clear all provisioning break and also clear global provisioning break
 * configuration. Is necessary clear provisioning break for another test!
 */
private void clearProvisioningBreakConfiguration() {
    // remove specific configuration
    for (SysProvisioningBreakConfigDto config : provisioningBreakConfig.find(null)) {
        provisioningBreakConfig.delete(config);
    }
    // 
    clearGlobalConfiguration(ProvisioningBreakConfiguration.GLOBAL_BREAK_DELETE_OPERATION);
    clearGlobalConfiguration(ProvisioningBreakConfiguration.GLOBAL_BREAK_UPDATE_OPERATION);
    clearGlobalConfiguration(ProvisioningBreakConfiguration.GLOBAL_BREAK_CREATE_OPERATION);
}
Also used : SysProvisioningBreakConfigDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningBreakConfigDto)

Example 17 with SysProvisioningBreakConfigDto

use of eu.bcvsolutions.idm.acc.dto.SysProvisioningBreakConfigDto in project CzechIdMng by bcvsolutions.

the class ProvisioningBreakProcessorTest method testRecipientIdentityIntegrity.

@Test
public void testRecipientIdentityIntegrity() {
    SysSystemDto systemDto = testHelper.createSystem(TestResource.TABLE_NAME);
    SysProvisioningBreakConfigDto breakConfig = createProvisioningBreak(20l, null, null, ProvisioningEventType.CREATE, systemDto.getId());
    // 
    IdmIdentityDto identityDto = testHelper.createIdentity();
    // 
    this.createRecipient(breakConfig.getId(), identityDto.getId(), null);
    // 
    int size = provisioningBreakRecipient.findAllByBreakConfig(breakConfig.getId()).size();
    assertEquals(1, size);
    // 
    identityService.delete(identityDto);
    // 
    size = provisioningBreakRecipient.findAllByBreakConfig(breakConfig.getId()).size();
    assertEquals(0, size);
}
Also used : SysProvisioningBreakConfigDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningBreakConfigDto) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 18 with SysProvisioningBreakConfigDto

use of eu.bcvsolutions.idm.acc.dto.SysProvisioningBreakConfigDto in project CzechIdMng by bcvsolutions.

the class ProvisioningBreakProcessorTest method testDisableCreateOperation.

@Test
public void testDisableCreateOperation() {
    SysSystemDto system = testHelper.createTestResourceSystem(true);
    IdmIdentityDto identity = testHelper.createIdentity();
    IdmIdentityDto identity2 = testHelper.createIdentity();
    IdmIdentityDto identity3 = testHelper.createIdentity();
    SysProvisioningBreakConfigDto breakConfig = createProvisioningBreak(20l, 2, null, ProvisioningEventType.CREATE, system.getId());
    IdmIdentityDto recipient = testHelper.createIdentity();
    createRecipient(breakConfig.getId(), recipient.getId(), null);
    // 
    this.createAccount(system, identity);
    this.createAccount(system, identity2);
    this.createAccount(system, identity3);
    // 
    provisioningService.doProvisioning(identity);
    provisioningService.doProvisioning(identity2);
    provisioningService.doProvisioning(identity3);
    // 
    IdmNotificationFilter filter = new IdmNotificationFilter();
    filter.setRecipient(recipient.getUsername());
    List<IdmNotificationLogDto> content = notificationLogService.find(filter, null).getContent();
    // two notification (notification +
    assertEquals(2, content.size());
    // parent)
    // 
    system = systemService.get(system.getId());
    assertNotEquals(Boolean.TRUE, system.getBlockedOperation().getUpdateOperation());
    assertEquals(Boolean.TRUE, system.getBlockedOperation().getCreateOperation());
    assertNotEquals(Boolean.TRUE, system.getBlockedOperation().getDeleteOperation());
}
Also used : SysProvisioningBreakConfigDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningBreakConfigDto) IdmNotificationLogDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationLogDto) IdmNotificationFilter(eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationFilter) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 19 with SysProvisioningBreakConfigDto

use of eu.bcvsolutions.idm.acc.dto.SysProvisioningBreakConfigDto in project CzechIdMng by bcvsolutions.

the class ProvisioningBreakProcessorTest method testDisableUpdateOperationWithZeroLimit.

@Test
public void testDisableUpdateOperationWithZeroLimit() {
    SysSystemDto system = testHelper.createTestResourceSystem(true);
    IdmIdentityDto identity = testHelper.createIdentity();
    SysProvisioningBreakConfigDto breakConfig = createProvisioningBreak(20l, 0, null, ProvisioningEventType.UPDATE, system.getId());
    IdmIdentityDto recipient = testHelper.createIdentity();
    createRecipient(breakConfig.getId(), recipient.getId(), null);
    // 
    this.createAccount(system, identity);
    // 
    // 
    // create
    provisioningService.doProvisioning(identity);
    provisioningService.doProvisioning(identity);
    // 
    IdmNotificationFilter filter = new IdmNotificationFilter();
    filter.setRecipient(recipient.getUsername());
    List<IdmNotificationLogDto> content = notificationLogService.find(filter, null).getContent();
    // two notification (notification +
    assertEquals(2, content.size());
    // parent)
    // 
    system = systemService.get(system.getId());
    assertEquals(Boolean.TRUE, system.getBlockedOperation().getUpdateOperation());
    assertNotEquals(Boolean.TRUE, system.getBlockedOperation().getCreateOperation());
    assertNotEquals(Boolean.TRUE, system.getBlockedOperation().getDeleteOperation());
}
Also used : SysProvisioningBreakConfigDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningBreakConfigDto) IdmNotificationLogDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationLogDto) IdmNotificationFilter(eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationFilter) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 20 with SysProvisioningBreakConfigDto

use of eu.bcvsolutions.idm.acc.dto.SysProvisioningBreakConfigDto in project CzechIdMng by bcvsolutions.

the class DefaultSysProvisioningBreakConfigService method getGlobalBreakConfiguration.

@Override
public SysProvisioningBreakConfigDto getGlobalBreakConfiguration(ProvisioningEventType eventType) {
    SysProvisioningBreakConfigDto globalConfig = new SysProvisioningBreakConfigDto();
    Boolean disable = provisioningBreakConfiguration.getDisabled(eventType);
    if (disable == null) {
        // global provisioning break configuration isn't set
        return null;
    }
    globalConfig.setDisabled(disable);
    globalConfig.setDisableLimit(provisioningBreakConfiguration.getDisableLimit(eventType));
    globalConfig.setGlobalConfiguration(Boolean.TRUE);
    // 
    IdmNotificationTemplateDto disabledTemplate = provisioningBreakConfiguration.getDisableTemplate(eventType);
    if (disabledTemplate != null) {
        globalConfig.setDisableTemplate(disabledTemplate.getId());
        globalConfig.setDisableTemplateEmbedded(disabledTemplate);
    }
    // 
    IdmNotificationTemplateDto warningTemplate = provisioningBreakConfiguration.getWarningTemplate(eventType);
    if (warningTemplate != null) {
        globalConfig.setWarningTemplate(warningTemplate.getId());
        globalConfig.setWarningTemplateEmbedded(warningTemplate);
    }
    // 
    globalConfig.setOperationType(eventType);
    globalConfig.setPeriod(provisioningBreakConfiguration.getPeriod(eventType));
    // global provisioning break hasn't system id, don't save global config
    globalConfig.setSystem(null);
    globalConfig.setWarningLimit(provisioningBreakConfiguration.getWarningLimit(eventType));
    globalConfig.setTrimmed(true);
    return globalConfig;
}
Also used : SysProvisioningBreakConfigDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningBreakConfigDto) IdmNotificationTemplateDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationTemplateDto)

Aggregations

SysProvisioningBreakConfigDto (eu.bcvsolutions.idm.acc.dto.SysProvisioningBreakConfigDto)24 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)16 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)15 Test (org.junit.Test)15 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)13 IdmNotificationLogDto (eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationLogDto)10 IdmNotificationFilter (eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationFilter)10 SysProvisioningBreakItems (eu.bcvsolutions.idm.acc.dto.SysProvisioningBreakItems)3 SysProvisioningBatchDto (eu.bcvsolutions.idm.acc.dto.SysProvisioningBatchDto)2 SysProvisioningOperationDto (eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto)2 SysSystemEntityDto (eu.bcvsolutions.idm.acc.dto.SysSystemEntityDto)2 SysProvisioningBreakConfigFilter (eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningBreakConfigFilter)2 ProvisioningException (eu.bcvsolutions.idm.acc.exception.ProvisioningException)2 IdmNotificationTemplateDto (eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationTemplateDto)2 ProvisioningEventType (eu.bcvsolutions.idm.acc.domain.ProvisioningEventType)1 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)1 DefaultEventResult (eu.bcvsolutions.idm.core.api.event.DefaultEventResult)1 ArrayList (java.util.ArrayList)1 PageImpl (org.springframework.data.domain.PageImpl)1 PageRequest (org.springframework.data.domain.PageRequest)1