Search in sources :

Example 1 with AccessMethodSecurityCallback

use of org.olat.resource.accesscontrol.model.AccessMethodSecurityCallback in project OpenOLAT by OpenOLAT.

the class ACFrontendManager method getAvailableMethods.

@Override
public List<AccessMethod> getAvailableMethods(Identity identity, Roles roles) {
    List<AccessMethod> methods = methodManager.getAvailableMethods();
    List<AccessMethod> allowedMethods = new ArrayList<>();
    for (AccessMethod method : methods) {
        AccessMethodHandler handler = accessModule.getAccessMethodHandler(method.getType());
        AccessMethodSecurityCallback secCallback = handler.getSecurityCallback(identity, roles);
        if (secCallback.canUse()) {
            allowedMethods.add(method);
        }
    }
    return methods;
}
Also used : AccessMethod(org.olat.resource.accesscontrol.model.AccessMethod) AccessMethodSecurityCallback(org.olat.resource.accesscontrol.model.AccessMethodSecurityCallback) ArrayList(java.util.ArrayList) AccessMethodHandler(org.olat.resource.accesscontrol.method.AccessMethodHandler)

Example 2 with AccessMethodSecurityCallback

use of org.olat.resource.accesscontrol.model.AccessMethodSecurityCallback in project openolat by klemens.

the class ACFrontendManager method getAvailableMethods.

@Override
public List<AccessMethod> getAvailableMethods(Identity identity, Roles roles) {
    List<AccessMethod> methods = methodManager.getAvailableMethods();
    List<AccessMethod> allowedMethods = new ArrayList<>();
    for (AccessMethod method : methods) {
        AccessMethodHandler handler = accessModule.getAccessMethodHandler(method.getType());
        AccessMethodSecurityCallback secCallback = handler.getSecurityCallback(identity, roles);
        if (secCallback.canUse()) {
            allowedMethods.add(method);
        }
    }
    return methods;
}
Also used : AccessMethod(org.olat.resource.accesscontrol.model.AccessMethod) AccessMethodSecurityCallback(org.olat.resource.accesscontrol.model.AccessMethodSecurityCallback) ArrayList(java.util.ArrayList) AccessMethodHandler(org.olat.resource.accesscontrol.method.AccessMethodHandler)

Aggregations

ArrayList (java.util.ArrayList)2 AccessMethodHandler (org.olat.resource.accesscontrol.method.AccessMethodHandler)2 AccessMethod (org.olat.resource.accesscontrol.model.AccessMethod)2 AccessMethodSecurityCallback (org.olat.resource.accesscontrol.model.AccessMethodSecurityCallback)2