Skip to content
Snippets Groups Projects
Commit cbeb7eea authored by brinn's avatar brinn
Browse files

Tighten authorization check.

SVN: 26172
parent e8c10517
No related branches found
No related tags found
No related merge requests found
...@@ -32,6 +32,7 @@ import ch.systemsx.cisd.openbis.generic.shared.authorization.RoleWithIdentifier; ...@@ -32,6 +32,7 @@ import ch.systemsx.cisd.openbis.generic.shared.authorization.RoleWithIdentifier;
import ch.systemsx.cisd.openbis.generic.shared.authorization.annotation.ShouldFlattenCollections; import ch.systemsx.cisd.openbis.generic.shared.authorization.annotation.ShouldFlattenCollections;
import ch.systemsx.cisd.openbis.generic.shared.authorization.predicate.AbstractSpacePredicate; import ch.systemsx.cisd.openbis.generic.shared.authorization.predicate.AbstractSpacePredicate;
import ch.systemsx.cisd.openbis.generic.shared.dto.PersonPE; import ch.systemsx.cisd.openbis.generic.shared.dto.PersonPE;
import ch.systemsx.cisd.openbis.generic.shared.dto.exception.UndefinedSpaceException;
import ch.systemsx.cisd.openbis.generic.shared.util.SpaceCodeHelper; import ch.systemsx.cisd.openbis.generic.shared.util.SpaceCodeHelper;
import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.PlateIdentifier; import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.PlateIdentifier;
...@@ -62,22 +63,27 @@ public class ScreeningPlateListReadOnlyPredicate extends ...@@ -62,22 +63,27 @@ public class ScreeningPlateListReadOnlyPredicate extends
final List<String> permIds = new ArrayList<String>(plates.size()); final List<String> permIds = new ArrayList<String>(plates.size());
for (PlateIdentifier plate : plates) for (PlateIdentifier plate : plates)
{ {
boolean hasPermId = false;
if (plate.getPermId() != null) if (plate.getPermId() != null)
{ {
permIds.add(plate.getPermId()); permIds.add(plate.getPermId());
} else hasPermId = true;
}
final String spaceCodeOrNull =
SpaceCodeHelper.getSpaceCode(person, plate.tryGetSpaceCode());
if (spaceCodeOrNull == null && hasPermId == false)
{
throw new UndefinedSpaceException();
}
if (spaceCodeOrNull != null && plate.isSharedPlate() == false)
{ {
final String spaceCode = final Status status =
SpaceCodeHelper.getSpaceCode(person, plate.tryGetSpaceCode()); evaluate(person, allowedRoles, authorizationDataProvider
if (plate.isSharedPlate() == false) .getHomeDatabaseInstance(), spaceCodeOrNull);
if (Status.OK.equals(status) == false)
{ {
final Status status = return status;
evaluate(person, allowedRoles, authorizationDataProvider
.getHomeDatabaseInstance(), spaceCode);
if (Status.OK.equals(status) == false)
{
return status;
}
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment