Search in sources :

Example 1 with PermissionRules

use of org.mamute.auth.rules.PermissionRules in project mamute by caelum.

the class RulesInterceptor method intercept.

@Override
public void intercept(InterceptorStack stack, ControllerMethod method, Object obj) throws InterceptionException {
    ClassController<KarmaCalculator> mirrorOnKarma = new Mirror().on(KarmaCalculator.class);
    List<Field> karmaCalculatorFields = mirrorOnKarma.reflectAll().fields();
    for (Field field : karmaCalculatorFields) {
        result.include(field.getName(), mirrorOnKarma.get().field(field));
    }
    PermissionRules[] rules = PermissionRules.values();
    for (PermissionRules rule : rules) {
        long karma = environmentKarma.get(rule);
        result.include(rule.name(), karma);
    }
    stack.next(method, obj);
}
Also used : Field(java.lang.reflect.Field) KarmaCalculator(org.mamute.reputation.rules.KarmaCalculator) Mirror(net.vidageek.mirror.dsl.Mirror) PermissionRules(org.mamute.auth.rules.PermissionRules)

Aggregations

Field (java.lang.reflect.Field)1 Mirror (net.vidageek.mirror.dsl.Mirror)1 PermissionRules (org.mamute.auth.rules.PermissionRules)1 KarmaCalculator (org.mamute.reputation.rules.KarmaCalculator)1