Project

General

Profile

Actions

Defect #3392

closed

Account protection doesn't work

Added by Ondřej Kopr over 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Peter Štrunc
Category:
Provisioning
Target version:
Start date:
06/13/2023
Due date:
% Done:

100%

Estimated time:
Affected versions:
Owner:
Peter Štrunc

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));

Actions #2

Updated by Peter Štrunc over 1 year ago

  • Status changed from New to In Progress
  • Target version set to 13.0.6
Actions #3

Updated by Peter Štrunc over 1 year ago

  • Status changed from In Progress to Needs feedback
  • % Done changed from 0 to 80
Actions #4

Updated by Peter Štrunc over 1 year ago

  • Assignee changed from Peter Štrunc to Ondřej Kopr
  • Owner set to Peter Štrunc
Actions #5

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?

Actions #6

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?

Actions #7

Updated by Peter Štrunc over 1 year ago

  • Status changed from In Progress to Needs feedback
Actions #8

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.

Actions #9

Updated by Peter Štrunc about 1 year ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF