@Test public void noActionForNullRight() throws ComponentLookupException { Assert.assertNull(this.mocker.getComponentUnderTest().hasAccess(this.user, null, this.doc)); }
@Override public Boolean hasAccess(User user, Right access, EntityReference entity) { if (!ObjectUtils.allNotNull(user, access, entity) || access.getTargetedEntityType() == null || !access.getTargetedEntityType().contains(EntityType.DOCUMENT)) { return null; } PrimaryEntity primaryEntity = this.resolver.resolveEntity(entity.toString()); if (primaryEntity == null) { return null; } AccessLevel grantedAccess = this.accessHelper.getAccessLevel(primaryEntity, user.getProfileDocument()); Right grantedRight = grantedAccess.getGrantedRight(); if (grantedRight.equals(access) || (grantedRight.getImpliedRights() != null && grantedRight.getImpliedRights().contains(access))) { return true; } return null; }
CollaboratorAccessAuthorizationModule implements AuthorizationModule { @Override public Boolean hasAccess(User user, Right access, EntityReference entity) { if (!ObjectUtils.allNotNull(user, access, entity) || access.getTargetedEntityType() == null || !access.getTargetedEntityType().contains(EntityType.DOCUMENT)) { return null; } PrimaryEntity primaryEntity = this.resolver.resolveEntity(entity.toString()); if (primaryEntity == null) { return null; } AccessLevel grantedAccess = this.accessHelper.getAccessLevel(primaryEntity, user.getProfileDocument()); Right grantedRight = grantedAccess.getGrantedRight(); if (grantedRight.equals(access) || (grantedRight.getImpliedRights() != null && grantedRight.getImpliedRights().contains(access))) { return true; } return null; } }
CollaboratorAccessAuthorizationModule implements AuthorizationModule { @Override public Boolean hasAccess(User user, Right access, EntityReference entity) { if (!ObjectUtils.allNotNull(user, access, entity) || access.getTargetedEntityType() == null || !access.getTargetedEntityType().contains(EntityType.DOCUMENT)) { return null; } PrimaryEntity primaryEntity = this.resolver.resolveEntity(entity.toString()); if (primaryEntity == null) { return null; } AccessLevel grantedAccess = this.accessHelper.getAccessLevel(primaryEntity, user.getProfileDocument()); Right grantedRight = grantedAccess.getGrantedRight(); if (grantedRight.equals(access) || (grantedRight.getImpliedRights() != null && grantedRight.getImpliedRights().contains(access))) { return true; } return null; }  }
CollaboratorAccessAuthorizationModule implements AuthorizationModule { @Override public Boolean hasAccess(User user, Right access, EntityReference entity) { if (!ObjectUtils.allNotNull(user, access, entity) || access.getTargetedEntityType() == null || !access.getTargetedEntityType().contains(EntityType.DOCUMENT)) { return null; } PrimaryEntity primaryEntity = this.resolver.resolveEntity(entity.toString()); if (primaryEntity == null) { return null; } AccessLevel grantedAccess = this.accessHelper.getAccessLevel(primaryEntity, user.getProfileDocument()); Right grantedRight = grantedAccess.getGrantedRight(); if (grantedRight.equals(access) || (grantedRight.getImpliedRights() != null && grantedRight.getImpliedRights().contains(access))) { return true; } return null; }  @Override int getPriority(); @Override Boolean hasAccess(User user, Right access, EntityReference entity); }
CollaboratorAccessAuthorizationModule implements AuthorizationModule { @Override public Boolean hasAccess(User user, Right access, EntityReference entity) { if (!ObjectUtils.allNotNull(user, access, entity) || access.getTargetedEntityType() == null || !access.getTargetedEntityType().contains(EntityType.DOCUMENT)) { return null; } PrimaryEntity primaryEntity = this.resolver.resolveEntity(entity.toString()); if (primaryEntity == null) { return null; } AccessLevel grantedAccess = this.accessHelper.getAccessLevel(primaryEntity, user.getProfileDocument()); Right grantedRight = grantedAccess.getGrantedRight(); if (grantedRight.equals(access) || (grantedRight.getImpliedRights() != null && grantedRight.getImpliedRights().contains(access))) { return true; } return null; }  @Override int getPriority(); @Override Boolean hasAccess(User user, Right access, EntityReference entity);  }