Search in sources :

Example 1 with ExpressionPermissionProfile

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

the class ScriptExpression method formatProfile.

private String formatProfile() {
    StringBuilder sb = new StringBuilder();
    if (expressionProfile != null) {
        sb.append(expressionProfile.getIdentifier());
    } else {
        sb.append("null (no profile)");
    }
    if (scriptExpressionProfile != null) {
        sb.append("; ");
        ExpressionPermissionProfile permissionProfile = scriptExpressionProfile.getPermissionProfile();
        if (permissionProfile != null) {
            sb.append("permission=").append(permissionProfile.getIdentifier());
        }
    }
    return sb.toString();
}
Also used : ExpressionPermissionProfile(com.evolveum.midpoint.schema.expression.ExpressionPermissionProfile)

Example 2 with ExpressionPermissionProfile

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

the class ExpressionProfileCompiler method compilePermissionProfile.

private ExpressionPermissionProfile compilePermissionProfile(ExpressionPermissionProfileType permissionProfileType) {
    ExpressionPermissionProfile profile = new ExpressionPermissionProfile(permissionProfileType.getIdentifier());
    profile.setDecision(AccessDecision.translate(permissionProfileType.getDecision()));
    profile.getPackageProfiles().addAll(permissionProfileType.getPackage());
    profile.getClassProfiles().addAll(permissionProfileType.getClazz());
    return profile;
}
Also used : ExpressionPermissionProfile(com.evolveum.midpoint.schema.expression.ExpressionPermissionProfile)

Example 3 with ExpressionPermissionProfile

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

the class ExpressionProfileCompiler method compile.

public ExpressionProfiles compile(SystemConfigurationExpressionsType expressionsType) throws SchemaException {
    List<ExpressionPermissionProfile> permissionProfiles = compilePermissionProfiles(expressionsType.getPermissionProfile());
    ExpressionProfiles expressionProfiles = compileExpressionProfiles(expressionsType.getExpressionProfile(), permissionProfiles);
    return expressionProfiles;
}
Also used : ExpressionPermissionProfile(com.evolveum.midpoint.schema.expression.ExpressionPermissionProfile) ExpressionProfiles(com.evolveum.midpoint.schema.expression.ExpressionProfiles)

Example 4 with ExpressionPermissionProfile

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

the class TestGroovyExpressionsSandbox method getScriptExpressionProfile.

@Override
protected ScriptExpressionProfile getScriptExpressionProfile(String language) {
    ScriptExpressionProfile profile = new ScriptExpressionProfile(language);
    profile.setTypeChecking(true);
    ExpressionPermissionProfile permissionProfile = new ExpressionPermissionProfile(this.getClass().getSimpleName());
    profile.setPermissionProfile(permissionProfile);
    permissionProfile.addClassAccessRule(Poison.class, AccessDecision.ALLOW);
    permissionProfile.addClassAccessRule(Poison.class, "smell", AccessDecision.DENY);
    permissionProfile.addClassAccessRule(Poison.class, "drink", AccessDecision.DENY);
    permissionProfile.addClassAccessRule(String.class, AccessDecision.ALLOW);
    permissionProfile.addClassAccessRule(String.class, "execute", AccessDecision.DENY);
    permissionProfile.addClassAccessRule(List.class, AccessDecision.ALLOW);
    permissionProfile.addClassAccessRule(List.class, "execute", AccessDecision.DENY);
    permissionProfile.setDecision(AccessDecision.ALLOW);
    return profile;
}
Also used : ExpressionPermissionProfile(com.evolveum.midpoint.schema.expression.ExpressionPermissionProfile) ScriptExpressionProfile(com.evolveum.midpoint.schema.expression.ScriptExpressionProfile)

Aggregations

ExpressionPermissionProfile (com.evolveum.midpoint.schema.expression.ExpressionPermissionProfile)4 ExpressionProfiles (com.evolveum.midpoint.schema.expression.ExpressionProfiles)1 ScriptExpressionProfile (com.evolveum.midpoint.schema.expression.ScriptExpressionProfile)1