Skip to content

Commit

Permalink
Possible fix of DeleteTaskHandler: skipping protected objects
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Jul 1, 2015
1 parent 24f4945 commit b826053
Showing 1 changed file with 9 additions and 0 deletions.
Expand Up @@ -66,6 +66,7 @@
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType;

/**
Expand Down Expand Up @@ -202,6 +203,14 @@ public <O extends ObjectType> TaskRunResult runInternal(Task task) {
objects = modelService.searchObjects(objectType, query, searchOptions, task, opResult);

for(PrismObject<O> object: objects) {

if (!optionRaw && ShadowType.class.isAssignableFrom(objectType)
&& Boolean.TRUE == ((ShadowType)(object.asObjectable())).isProtectedObject()) {
LOGGER.debug("Skipping delete of protected object {}", object);
progress++;
continue;
}

ObjectDelta<?> delta = ObjectDelta.createDeleteDelta(objectType, object.getOid(), prismContext);
modelService.executeChanges(MiscSchemaUtil.createCollection(delta), execOptions, task, opResult);
progress++;
Expand Down

0 comments on commit b826053

Please sign in to comment.