Search in sources :

Example 1 with ExpressionEvaluatorProfile

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;
}
Also used : ScriptExpressionProfileType(com.evolveum.midpoint.xml.ns._public.common.common_3.ScriptExpressionProfileType) ExpressionEvaluatorProfile(com.evolveum.midpoint.schema.expression.ExpressionEvaluatorProfile)

Example 2 with ExpressionEvaluatorProfile

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;
}
Also used : ExpressionEvaluatorProfile(com.evolveum.midpoint.schema.expression.ExpressionEvaluatorProfile) ScriptExpressionProfile(com.evolveum.midpoint.schema.expression.ScriptExpressionProfile) ExpressionProfile(com.evolveum.midpoint.schema.expression.ExpressionProfile)

Example 3 with ExpressionEvaluatorProfile

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;
}
Also used : SecurityViolationException(com.evolveum.midpoint.util.exception.SecurityViolationException) ExpressionEvaluatorProfile(com.evolveum.midpoint.schema.expression.ExpressionEvaluatorProfile) ScriptExpressionProfile(com.evolveum.midpoint.schema.expression.ScriptExpressionProfile)

Aggregations

ExpressionEvaluatorProfile (com.evolveum.midpoint.schema.expression.ExpressionEvaluatorProfile)3 ScriptExpressionProfile (com.evolveum.midpoint.schema.expression.ScriptExpressionProfile)2 ExpressionProfile (com.evolveum.midpoint.schema.expression.ExpressionProfile)1 SecurityViolationException (com.evolveum.midpoint.util.exception.SecurityViolationException)1 ScriptExpressionProfileType (com.evolveum.midpoint.xml.ns._public.common.common_3.ScriptExpressionProfileType)1