Skip to content

Commit

Permalink
fixing protected shadows (protected flag should not be stored in repo)..
Browse files Browse the repository at this point in the history
  • Loading branch information
katkav committed May 30, 2014
1 parent 4832451 commit 7d6c80a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Expand Up @@ -1556,7 +1556,7 @@ private PrismObject<ShadowType> completeShadow(ConnectorInstance connector, Pris
accessChecker.filterGetAttributes(resultAttibutes, objectClassDefinition, parentResult);
resultShadow.add(resultAttibutes);

resultShadowType.setProtectedObject(resourceShadowType.isProtectedObject());
// resultShadowType.setProtectedObject(resourceShadowType.isProtectedObject());
resultShadowType.setIgnored(resourceShadowType.isIgnored());

resultShadowType.setActivation(resourceShadowType.getActivation());
Expand All @@ -1566,6 +1566,10 @@ private PrismObject<ShadowType> completeShadow(ConnectorInstance connector, Pris
ShadowType resourceAccountShadow = resourceShadow.asObjectable();
resultAccountShadow.setCredentials(resourceAccountShadow.getCredentials());
}

//protected
resouceObjectConverter.setProtectedFlag(resource, objectClassDefinition, resultShadow);
// resultShadowType.setProtectedObject();

// Activation
ActivationType resultActivationType = resultShadowType.getActivation();
Expand Down
Expand Up @@ -576,6 +576,7 @@ public PrismObject<ShadowType> createRepositoryShadow(PrismObject<ShadowType> sh
ShadowType repoShadowType = repoShadow.asObjectable();

setKindIfNecessary(repoShadowType, objectClassDefinition);
// setIntentIfNecessary(repoShadowType, objectClassDefinition);

// We don't want to store credentials in the repo
repoShadowType.setCredentials(null);
Expand All @@ -601,6 +602,10 @@ public PrismObject<ShadowType> createRepositoryShadow(PrismObject<ShadowType> sh
repoShadowType.setObjectClass(attributesContainer.getDefinition().getTypeName());
}

if (repoShadowType.isProtectedObject() != null){
repoShadowType.setProtectedObject(null);
}

normalizeAttributes(repoShadow, objectClassDefinition);

return repoShadow;
Expand All @@ -611,6 +616,12 @@ public void setKindIfNecessary(ShadowType repoShadowType, RefinedObjectClassDefi
repoShadowType.setKind(objectClassDefinition.getKind());
}
}

public void setIntentIfNecessary(ShadowType repoShadowType, RefinedObjectClassDefinition objectClassDefinition) {
if (repoShadowType.getIntent() == null && objectClassDefinition.getIntent() != null) {
repoShadowType.setIntent(objectClassDefinition.getIntent());
}
}

private void normalizeAttributes(PrismObject<ShadowType> shadow, RefinedObjectClassDefinition objectClassDefinition) throws SchemaException {
for (ResourceAttribute<?> attribute: ShadowUtil.getAttributes(shadow)) {
Expand Down

0 comments on commit 7d6c80a

Please sign in to comment.