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 over 1 year ago
- Status changed from New to In Progress
- Target version set to 13.0.6
Updated by Peter Štrunc over 1 year 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 Peter Štrunc over 1 year ago
- Assignee changed from Peter Štrunc to Ondřej Kopr
- Owner set to Peter Štrunc
Updated by Ondřej Kopr over 1 year 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?
Updated by Peter Štrunc over 1 year ago
I have patched the second method so that it won't hurt so much next time. Could you check it out again please?
Updated by Peter Štrunc over 1 year ago
- Status changed from In Progress to Needs feedback
Updated by Ondřej Kopr over 1 year ago
- Status changed from Needs feedback to Resolved
- Assignee changed from Ondřej Kopr to Peter Štrunc
- % Done changed from 80 to 100
Oh my dear! Delicious juicy lucy. It looks awesome!
Thank you.