@WithMockUser(username = USERNAME) @Test void testAdd() { Entity entity = getEntityMock(); MutableAcl acl = mock(MutableAcl.class); when(mutableAclService.createAcl(new EntityIdentity(entity))).thenReturn(acl); rowLevelSecurityRepositoryDecorator.add(entity); verify(acl).insertAce(0, PermissionSet.WRITE, new PrincipalSid(USERNAME), true); verify(delegateRepository).add(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 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);  }