use of com.evolveum.midpoint.schema.expression.ExpressionEvaluatorProfile in project midpoint by Evolveum.
the class ExpressionProfileCompiler method compileEvaluatorProfile.
private ExpressionEvaluatorProfile compileEvaluatorProfile(ExpressionEvaluatorProfileType evaluatorType, List<ExpressionPermissionProfile> permissionProfiles) throws SchemaException {
ExpressionEvaluatorProfile profile = new ExpressionEvaluatorProfile(evaluatorType.getType());
profile.setDecision(AccessDecision.translate(evaluatorType.getDecision()));
for (ScriptExpressionProfileType scriptType : evaluatorType.getScript()) {
profile.add(compileScriptProfile(scriptType, permissionProfiles));
}
return profile;
}
use of com.evolveum.midpoint.schema.expression.ExpressionEvaluatorProfile in project midpoint by Evolveum.
the class AbstractScriptTest method getExpressionProfile.
protected ExpressionProfile getExpressionProfile(ScriptExpressionProfile scriptExpressionProfile) {
if (scriptExpressionProfile == null) {
return null;
}
ExpressionProfile expressionProfile = new ExpressionProfile(this.getClass().getSimpleName());
expressionProfile.setDecision(AccessDecision.DENY);
ExpressionEvaluatorProfile evaluatorProfile = new ExpressionEvaluatorProfile(ScriptExpressionEvaluatorFactory.ELEMENT_NAME);
expressionProfile.add(evaluatorProfile);
evaluatorProfile.setDecision(AccessDecision.DENY);
evaluatorProfile.add(scriptExpressionProfile);
return expressionProfile;
}
use of com.evolveum.midpoint.schema.expression.ExpressionEvaluatorProfile in project midpoint by Evolveum.
the class ScriptExpressionFactory method processScriptExpressionProfile.
private ScriptExpressionProfile processScriptExpressionProfile(ExpressionProfile expressionProfile, String language, String shortDesc) throws SecurityViolationException {
if (expressionProfile == null) {
return null;
}
ExpressionEvaluatorProfile evaluatorProfile = expressionProfile.getEvaluatorProfile(ScriptExpressionEvaluatorFactory.ELEMENT_NAME);
if (evaluatorProfile == null) {
if (expressionProfile.getDecision() == AccessDecision.ALLOW) {
return null;
} else {
throw new SecurityViolationException("Access to script expression evaluator " + " not allowed (expression profile: " + expressionProfile.getIdentifier() + ") in " + shortDesc);
}
}
ScriptExpressionProfile scriptProfile = evaluatorProfile.getScriptExpressionProfile(language);
if (scriptProfile == null) {
if (evaluatorProfile.getDecision() == AccessDecision.ALLOW) {
return null;
} else {
throw new SecurityViolationException("Access to script language " + language + " not allowed (expression profile: " + expressionProfile.getIdentifier() + ") in " + shortDesc);
}
}
return scriptProfile;
}
Aggregations