Search in sources :

Example 6 with ScriptExpressionProfile

use of com.evolveum.midpoint.schema.expression.ScriptExpressionProfile in project midpoint by Evolveum.

the class SandboxTypeCheckingExtension method decideClass.

private AccessDecision decideClass(String className, String methodName) {
    AccessDecision decision = GroovyScriptEvaluator.decideGroovyBuiltin(className, methodName);
    LOGGER.trace("decideClass: builtin [{},{}] : {}", className, methodName, decision);
    if (decision != AccessDecision.DEFAULT) {
        return decision;
    }
    ScriptExpressionProfile scriptExpressionProfile = getContext().getScriptExpressionProfile();
    if (scriptExpressionProfile == null) {
        LOGGER.trace("decideClass: profile==null [{},{}] : ALLOW", className, methodName);
        return AccessDecision.ALLOW;
    }
    decision = scriptExpressionProfile.decideClassAccess(className, methodName);
    LOGGER.trace("decideClass: profile({}) [{},{}] : {}", getContext().getExpressionProfile().getIdentifier(), className, methodName, decision);
    return decision;
}
Also used : AccessDecision(com.evolveum.midpoint.schema.AccessDecision) ScriptExpressionProfile(com.evolveum.midpoint.schema.expression.ScriptExpressionProfile)

Example 7 with ScriptExpressionProfile

use of com.evolveum.midpoint.schema.expression.ScriptExpressionProfile in project midpoint by Evolveum.

the class GroovyScriptEvaluator method getGroovyLoader.

private GroovyClassLoader getGroovyLoader(ScriptExpressionEvaluationContext context) throws SecurityViolationException {
    GroovyClassLoader groovyClassLoader = getScriptCache().getInterpreter(context.getExpressionProfile());
    if (groovyClassLoader != null) {
        return groovyClassLoader;
    }
    ScriptExpressionProfile scriptExpressionProfile = context.getScriptExpressionProfile();
    groovyClassLoader = createGroovyLoader(scriptExpressionProfile, context);
    getScriptCache().putInterpreter(context.getExpressionProfile(), groovyClassLoader);
    return groovyClassLoader;
}
Also used : GroovyClassLoader(groovy.lang.GroovyClassLoader) ScriptExpressionProfile(com.evolveum.midpoint.schema.expression.ScriptExpressionProfile)

Aggregations

ScriptExpressionProfile (com.evolveum.midpoint.schema.expression.ScriptExpressionProfile)7 ExpressionEvaluatorProfile (com.evolveum.midpoint.schema.expression.ExpressionEvaluatorProfile)2 AccessDecision (com.evolveum.midpoint.schema.AccessDecision)1 ExpressionPermissionProfile (com.evolveum.midpoint.schema.expression.ExpressionPermissionProfile)1 ExpressionProfile (com.evolveum.midpoint.schema.expression.ExpressionProfile)1 SecurityViolationException (com.evolveum.midpoint.util.exception.SecurityViolationException)1 GroovyClassLoader (groovy.lang.GroovyClassLoader)1