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

Skip further checks in predicates if caller has instance-wide write permissions.

SVN: 26785
parent ff311603
No related branches found
No related tags found
No related merge requests found
......@@ -73,6 +73,12 @@ public class DataSetUpdatesCollectionPredicate extends
protected Status doEvaluation(PersonPE person, List<RoleWithIdentifier> allowedRoles,
List<? extends DataSetUpdatesDTO> value)
{
// Skip all further checks if the person has instance-wide write permissions.
if (hasInstanceWritePermissions(person, allowedRoles).isOK())
{
return Status.OK;
}
List<TechId> techIds = new ArrayList<TechId>();
List<SampleOwnerIdentifier> sampleIdentifiers = new ArrayList<SampleOwnerIdentifier>();
for (DataSetUpdatesDTO dataSetUpdates : value)
......
......@@ -58,11 +58,18 @@ public class ExperimentUpdatesPredicate extends AbstractPredicate<ExperimentUpda
}
@Override
protected
Status doEvaluation(final PersonPE person, final List<RoleWithIdentifier> allowedRoles,
protected Status doEvaluation(final PersonPE person,
final List<RoleWithIdentifier> allowedRoles,
final ExperimentUpdatesDTO updates)
{
assert experimentTechIdPredicate.initialized : "Predicate has not been initialized";
// Skip all further checks if the person has instance-wide write permissions.
if (hasInstanceWritePermissions(person, allowedRoles).isOK())
{
return Status.OK;
}
Status status;
status =
experimentTechIdPredicate.doEvaluation(person, allowedRoles, updates
......
......@@ -59,6 +59,12 @@ public class NewExternalDataPredicate extends AbstractPredicate<NewExternalData>
protected Status doEvaluation(PersonPE person, List<RoleWithIdentifier> allowedRoles,
NewExternalData value)
{
// Skip all further checks if the person has instance-wide write permissions.
if (hasInstanceWritePermissions(person, allowedRoles).isOK())
{
return Status.OK;
}
SampleIdentifier sampleIdentifier = value.getSampleIdentifierOrNull();
if (sampleIdentifier != null)
{
......
......@@ -83,6 +83,12 @@ public class SampleOwnerIdentifierPredicate extends AbstractPredicate<SampleOwne
public Status performEvaluation(final PersonPE person,
final List<RoleWithIdentifier> allowedRoles, final SampleOwnerIdentifier value)
{
// Skip all further checks if the person has instance-wide write permissions.
if (hasInstanceWritePermissions(person, allowedRoles).isOK())
{
return Status.OK;
}
if (value.isDatabaseInstanceLevel())
{
return databaseInstanceIdentifierPredicate.doEvaluation(person, allowedRoles,
......
......@@ -70,6 +70,12 @@ public class SampleUpdatesCollectionPredicate extends AbstractPredicate<List<Sam
protected Status doEvaluation(PersonPE person, List<RoleWithIdentifier> allowedRoles,
List<SampleUpdatesDTO> value)
{
// Skip all further checks if the person has instance-wide write permissions.
if (hasInstanceWritePermissions(person, allowedRoles).isOK())
{
return Status.OK;
}
List<TechId> techIds = new ArrayList<TechId>(value.size());
List<SampleOwnerIdentifier> sampleIdentifiers =
new ArrayList<SampleOwnerIdentifier>(value.size());
......
......@@ -57,6 +57,12 @@ public class SpaceIdentifierPredicate extends AbstractSpacePredicate<SpaceIdenti
protected Status doEvaluation(final PersonPE person,
final List<RoleWithIdentifier> allowedRoles, final SpaceIdentifier spaceIdentifier)
{
// Skip all further checks if the person has instance-wide write permissions.
if (hasInstanceWritePermissions(person, allowedRoles).isOK())
{
return Status.OK;
}
assert initialized : "Predicate has not been initialized";
final String spaceCode = SpaceCodeHelper.getSpaceCode(person, spaceIdentifier);
final DatabaseInstancePE databaseInstance = getDatabaseInstance(spaceIdentifier);
......
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