@Test public void allDocumentAccessGrantedForGuestUser() throws ComponentLookupException { Assert.assertTrue(this.mocker.getComponentUnderTest().hasAccess(null, Right.VIEW, this.doc)); Assert.assertTrue(this.mocker.getComponentUnderTest().hasAccess(null, Right.EDIT, this.doc)); Assert.assertTrue(this.mocker.getComponentUnderTest().hasAccess(null, Right.COMMENT, this.doc)); Assert.assertTrue(this.mocker.getComponentUnderTest().hasAccess(null, Right.DELETE, this.doc)); Assert.assertTrue(this.mocker.getComponentUnderTest().hasAccess(null, ManageRight.MANAGE, this.doc)); }
@Override public Boolean hasAccess(User user, Right access, EntityReference entity) { if (!ObjectUtils.allNotNull(access, entity) || access.getTargetedEntityType() == null || !access.getTargetedEntityType().contains(EntityType.DOCUMENT)) { return null; } PrimaryEntity primaryEntity = this.resolver.resolveEntity(entity.toString()); if (primaryEntity == null) { return null; } Owner owner = this.manager.getEntityAccess(primaryEntity).getOwner(); if (owner.getUser() == null) { return true; } return null; }
AccessToGuestOwnedRecordsAuthorizationModule implements AuthorizationModule { @Override public Boolean hasAccess(User user, Right access, EntityReference entity) { if (!ObjectUtils.allNotNull(access, entity) || access.getTargetedEntityType() == null || !access.getTargetedEntityType().contains(EntityType.DOCUMENT)) { return null; } PrimaryEntity primaryEntity = this.resolver.resolveEntity(entity.toString()); if (primaryEntity == null) { return null; } Owner owner = this.manager.getEntityAccess(primaryEntity).getOwner(); if (owner.getUser() == null) { return true; } return null; } }
AccessToGuestOwnedRecordsAuthorizationModule implements AuthorizationModule { @Override public Boolean hasAccess(User user, Right access, EntityReference entity) { if (!ObjectUtils.allNotNull(access, entity) || access.getTargetedEntityType() == null || !access.getTargetedEntityType().contains(EntityType.DOCUMENT)) { return null; } PrimaryEntity primaryEntity = this.resolver.resolveEntity(entity.toString()); if (primaryEntity == null) { return null; } Owner owner = this.manager.getEntityAccess(primaryEntity).getOwner(); if (owner.getUser() == null) { return true; } return null; }  }
AccessToGuestOwnedRecordsAuthorizationModule implements AuthorizationModule { @Override public Boolean hasAccess(User user, Right access, EntityReference entity) { if (!ObjectUtils.allNotNull(access, entity) || access.getTargetedEntityType() == null || !access.getTargetedEntityType().contains(EntityType.DOCUMENT)) { return null; } PrimaryEntity primaryEntity = this.resolver.resolveEntity(entity.toString()); if (primaryEntity == null) { return null; } Owner owner = this.manager.getEntityAccess(primaryEntity).getOwner(); if (owner.getUser() == null) { return true; } return null; }  @Override int getPriority(); @Override Boolean hasAccess(User user, Right access, EntityReference entity); }
AccessToGuestOwnedRecordsAuthorizationModule implements AuthorizationModule { @Override public Boolean hasAccess(User user, Right access, EntityReference entity) { if (!ObjectUtils.allNotNull(access, entity) || access.getTargetedEntityType() == null || !access.getTargetedEntityType().contains(EntityType.DOCUMENT)) { return null; } PrimaryEntity primaryEntity = this.resolver.resolveEntity(entity.toString()); if (primaryEntity == null) { return null; } Owner owner = this.manager.getEntityAccess(primaryEntity).getOwner(); if (owner.getUser() == null) { return true; } return null; }  @Override int getPriority(); @Override Boolean hasAccess(User user, Right access, EntityReference entity);  }