Defect #3392
closedAccount protection doesn't work
100%
Description
After project upgraded to version 13.0.x can exist more mapping for provisioning and same entity type.
This behavior brokes account protection because one of mapping can setup account protection, but after account delete isn't setup protection because in method missing check specific mapping:
DefaultSysSystemMappingService#getProtectionInterval
@Override
public Integer getProtectionInterval(AccAccountDto account) {
Assert.notNull(account, "Account cannot be null!");
Assert.notNull(account.getEntityType(), "EntityType cannot be null!");
SysSystemDto system = DtoUtils.getEmbedded(account, AccAccount_.system);
List<SysSystemMappingDto> mappings = this.findBySystem(system, SystemOperationType.PROVISIONING,
account.getEntityType());
if (mappings.isEmpty()) {
return -1;
}
// We assume only one mapping for provisioning and entity type.
return this.getProtectionInterval(mappings.get(0));
}
This is probably problem:
return this.getProtectionInterval(mappings.get(0));
Updated by Peter Štrunc 11 months ago
- Status changed from In Progress to Needs feedback
- % Done changed from 0 to 80
Fixed here https://github.com/bcvsolutions/CzechIdMng/pull/401
Looking for reviewer.
Updated by Ondřej Kopr 10 months ago
- Status changed from Needs feedback to In Progress
Hi Peters i had morning wood from your fix, but after I tried, it was like my first time. It hurts!
The protection still doesn't work correctly. One part works correctly. But when I had two mappings for same object the protection can be activate for mapping that hasn't this feature setup.
There is also method: isEnabledProtection that must be updated:
public boolean isEnabledProtection(AccAccountDto account) { Assert.notNull(account, "Account cannot be null!"); Assert.notNull(account.getEntityType(), "EntityType cannot be null!"); SysSystemDto system = DtoUtils.getEmbedded(account, AccAccount_.system); List<SysSystemMappingDto> mappings = this.findBySystem(system, SystemOperationType.PROVISIONING, account.getEntityType()); if (mappings.isEmpty()) { return false; } // We assume only one mapping for provisioning and entity type. return this.isEnabledProtection(mappings.get(0)); }
Could you just update this behavior?