use of org.olat.resource.accesscontrol.method.AccessMethodHandler in project openolat by klemens.
the class MainAccessController method methodChoosed.
protected void methodChoosed(UserRequest ureq, OfferAccess link) {
if (link.getMethod().isNeedUserInteraction()) {
AccessControlModule module = (AccessControlModule) CoreSpringFactory.getBean("acModule");
AccessMethodHandler handler = module.getAccessMethodHandler(link.getMethod().getType());
if (handler != null) {
accessCtrl = handler.createAccessController(ureq, getWindowControl(), link, mainForm);
listenTo(accessCtrl);
flc.add("accessCmp", accessCtrl.getInitialFormItem());
}
} else {
doAccessResource(ureq, link);
}
}
use of org.olat.resource.accesscontrol.method.AccessMethodHandler in project openolat by klemens.
the class PublishStep01AccessForm method addConfiguration.
protected void addConfiguration(OfferAccess link) {
AccessMethodHandler methodHandler = acModule.getAccessMethodHandler(link.getMethod().getType());
AccessInfo infos = new AccessInfo(methodHandler.getMethodName(getLocale()), methodHandler.isPaymentMethod(), null, link);
infos.setButtonId(button_id);
confControllers.add(infos);
if (editable) {
FormLink editLink = uifactory.addFormLink("edit_" + infos.getButtonId(), "edit", "edit", null, confControllerContainer, Link.BUTTON_SMALL);
editLink.setUserObject(infos);
editLink.setIconLeftCSS("o_icon o_icon-fw o_icon_edit");
confControllerContainer.add(editLink.getName(), editLink);
FormLink delLink = uifactory.addFormLink("del_" + infos.getButtonId(), "delete", "delete", null, confControllerContainer, Link.BUTTON_SMALL);
delLink.setUserObject(infos);
delLink.setIconLeftCSS("o_icon o_icon-fw o_icon_delete_item");
confControllerContainer.add(delLink.getName(), delLink);
}
updateConfirmationEmail();
}
use of org.olat.resource.accesscontrol.method.AccessMethodHandler 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;
}
use of org.olat.resource.accesscontrol.method.AccessMethodHandler in project OpenOLAT by OpenOLAT.
the class AccessMethodRenderer method render.
private void render(StringOutput sb, AccessMethod method, Set<String> uniqueType, Locale locale) {
String type = method.getType();
if (uniqueType.contains(type))
return;
uniqueType.add(type);
AccessMethodHandler handler = acModule.getAccessMethodHandler(type);
sb.append("<span class='o_nowrap'><i class='o_icon ");
sb.append(method.getMethodCssClass());
sb.append("_icon o_icon-lg'> </i> ");
sb.append(handler.getMethodName(locale));
sb.append("</span>");
}
use of org.olat.resource.accesscontrol.method.AccessMethodHandler in project OpenOLAT by OpenOLAT.
the class MainAccessController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
backLink = uifactory.addFormLink("back", formLayout, Link.LINK_BACK);
FormLayoutContainer methodChooseContainer = FormLayoutContainer.createDefaultFormLayout("methodChooser", getTranslator());
methodChooseContainer.setRootForm(mainForm);
formLayout.add("methodChooser", methodChooseContainer);
for (OfferAccess link : links) {
AccessMethodHandler handler = acModule.getAccessMethodHandler(link.getMethod().getType());
String methodName = handler.getMethodName(getLocale());
FormLink accessButton = uifactory.addFormLink("m_" + link.getKey(), methodName, null, methodChooseContainer, Link.BUTTON + Link.NONTRANSLATED);
accessButton.setUserObject(link);
accessButtons.add(accessButton);
}
}
Aggregations