Search in sources :

Example 1 with PasswordPolicyEvent

use of eu.bcvsolutions.idm.core.model.event.PasswordPolicyEvent in project CzechIdMng by bcvsolutions.

the class DefaultIdmPasswordPolicyService method save.

@Override
@Transactional
public IdmPasswordPolicyDto save(IdmPasswordPolicyDto dto, BasePermission... permission) {
    Assert.notNull(dto);
    // 
    if (!ObjectUtils.isEmpty(permission)) {
        IdmPasswordPolicy persistEntity = null;
        if (dto.getId() != null) {
            persistEntity = this.getEntity(dto.getId());
            if (persistEntity != null) {
                // check access on previous entity - update is needed
                checkAccess(persistEntity, IdmBasePermission.UPDATE);
            }
        }
        // TODO: remove one checkAccess?
        checkAccess(toEntity(dto, persistEntity), permission);
    }
    // 
    LOG.debug("Saving entity [{}]", dto.getName());
    if (isNew(dto)) {
        // throw event with create
        return entityEventProcessorService.process(new PasswordPolicyEvent(PasswordPolicyEvenType.CREATE, dto)).getContent();
    }
    // else throw event with update
    return entityEventProcessorService.process(new PasswordPolicyEvent(PasswordPolicyEvenType.UPDATE, dto)).getContent();
}
Also used : IdmPasswordPolicy(eu.bcvsolutions.idm.core.model.entity.IdmPasswordPolicy) PasswordPolicyEvent(eu.bcvsolutions.idm.core.model.event.PasswordPolicyEvent) Transactional(org.springframework.transaction.annotation.Transactional)

Example 2 with PasswordPolicyEvent

use of eu.bcvsolutions.idm.core.model.event.PasswordPolicyEvent in project CzechIdMng by bcvsolutions.

the class DefaultIdmPasswordPolicyService method delete.

@Override
@Transactional
public void delete(IdmPasswordPolicyDto dto, BasePermission... permission) {
    checkAccess(this.getEntity(dto.getId()), permission);
    // 
    LOG.debug("Delete entity [{}]", dto.getName());
    // 
    entityEventProcessorService.process(new PasswordPolicyEvent(PasswordPolicyEvenType.DELETE, dto));
}
Also used : PasswordPolicyEvent(eu.bcvsolutions.idm.core.model.event.PasswordPolicyEvent) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

PasswordPolicyEvent (eu.bcvsolutions.idm.core.model.event.PasswordPolicyEvent)2 Transactional (org.springframework.transaction.annotation.Transactional)2 IdmPasswordPolicy (eu.bcvsolutions.idm.core.model.entity.IdmPasswordPolicy)1