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();
}
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));
}
Aggregations