@WithMockUser(username = USERNAME) @Test void testAddAlreadyExists() { Entity entity = getEntityMock(); when(mutableAclService.createAcl(new EntityIdentity(entity))) .thenThrow(new AlreadyExistsException("")); Exception exception = assertThrows( EntityAlreadyExistsException.class, () -> rowLevelSecurityRepositoryDecorator.add(entity)); assertThat(exception.getMessage()).containsPattern("type:entityTypeId id:entityId"); }
@Override public void createAcl(Entity entity) { MutableAcl acl; try { acl = mutableAclService.createAcl(new EntityIdentity(entity)); } catch (AlreadyExistsException e) { throw new EntityAlreadyExistsException(entity, e); } Sid sid = SidUtils.createSecurityContextSid(); acl.insertAce(acl.getEntries().size(), PermissionSet.WRITE, sid, true); mutableAclService.updateAcl(acl); }
RowLevelSecurityRepositoryDecorator extends AbstractRowLevelSecurityRepositoryDecorator<Entity> { @Override public void createAcl(Entity entity) { MutableAcl acl; try { acl = mutableAclService.createAcl(new EntityIdentity(entity)); } catch (AlreadyExistsException e) { throw new EntityAlreadyExistsException(entity, e); } Sid sid = SidUtils.createSecurityContextSid(); acl.insertAce(acl.getEntries().size(), PermissionSet.WRITE, sid, true); mutableAclService.updateAcl(acl); } }
RowLevelSecurityRepositoryDecorator extends AbstractRowLevelSecurityRepositoryDecorator<Entity> { @Override public void createAcl(Entity entity) { MutableAcl acl; try { acl = mutableAclService.createAcl(new EntityIdentity(entity)); } catch (AlreadyExistsException e) { throw new EntityAlreadyExistsException(entity, e); } Sid sid = SidUtils.createSecurityContextSid(); acl.insertAce(acl.getEntries().size(), PermissionSet.WRITE, sid, true); mutableAclService.updateAcl(acl); } RowLevelSecurityRepositoryDecorator(
      Repository<Entity> delegateRepository,
      UserPermissionEvaluator userPermissionEvaluator,
      MutableAclService mutableAclService); }
RowLevelSecurityRepositoryDecorator extends AbstractRowLevelSecurityRepositoryDecorator<Entity> { @Override public void createAcl(Entity entity) { MutableAcl acl; try { acl = mutableAclService.createAcl(new EntityIdentity(entity)); } catch (AlreadyExistsException e) { throw new EntityAlreadyExistsException(entity, e); } Sid sid = SidUtils.createSecurityContextSid(); acl.insertAce(acl.getEntries().size(), PermissionSet.WRITE, sid, true); mutableAclService.updateAcl(acl); } RowLevelSecurityRepositoryDecorator(
      Repository<Entity> delegateRepository,
      UserPermissionEvaluator userPermissionEvaluator,
      MutableAclService mutableAclService); @Override boolean isActionPermitted(Entity entity, Action operation); @Override boolean isActionPermitted(Object id, Action operation); @Override void throwPermissionException(Entity entity, Action action); @Override void createAcl(Entity entity); @Override void deleteAcl(Entity entity); @Override void deleteAcl(Object id); @Override void updateAcl(Entity entity); }
RowLevelSecurityRepositoryDecorator extends AbstractRowLevelSecurityRepositoryDecorator<Entity> { @Override public void createAcl(Entity entity) { MutableAcl acl; try { acl = mutableAclService.createAcl(new EntityIdentity(entity)); } catch (AlreadyExistsException e) { throw new EntityAlreadyExistsException(entity, e); } Sid sid = SidUtils.createSecurityContextSid(); acl.insertAce(acl.getEntries().size(), PermissionSet.WRITE, sid, true); mutableAclService.updateAcl(acl); } RowLevelSecurityRepositoryDecorator(
      Repository<Entity> delegateRepository,
      UserPermissionEvaluator userPermissionEvaluator,
      MutableAclService mutableAclService); @Override boolean isActionPermitted(Entity entity, Action operation); @Override boolean isActionPermitted(Object id, Action operation); @Override void throwPermissionException(Entity entity, Action action); @Override void createAcl(Entity entity); @Override void deleteAcl(Entity entity); @Override void deleteAcl(Object id); @Override void updateAcl(Entity entity);  }