use of org.olat.resource.accesscontrol.method.AccessMethodHandler in project OpenOLAT by OpenOLAT.
the class AccessMethodRenderer method render.
private void render(StringOutput sb, AccessTransaction transaction, Set<String> uniqueType, Locale locale) {
String type = transaction.getMethod().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(transaction.getMethod().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 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 OpenOLAT.
the class ACFrontendManager method accessResource.
@Override
public AccessResult accessResource(Identity identity, OfferAccess link, Object argument) {
if (link == null || link.getOffer() == null || link.getMethod() == null) {
log.audit("Access refused (no offer) to: " + link + " for " + identity);
return new AccessResult(false);
}
AccessMethodHandler handler = accessModule.getAccessMethodHandler(link.getMethod().getType());
if (handler == null) {
log.audit("Access refused (no handler method) to: " + link + " for " + identity);
return new AccessResult(false);
}
if (handler.checkArgument(link, argument)) {
if (allowAccesToResource(identity, link.getOffer())) {
Order order = orderManager.saveOneClick(identity, link);
AccessTransaction transaction = transactionManager.createTransaction(order, order.getParts().get(0), link.getMethod());
transactionManager.save(transaction);
dbInstance.commit();
log.audit("Access granted to: " + link + " for " + identity);
return new AccessResult(true);
} else {
log.audit("Access error to: " + link + " for " + identity);
}
} else {
log.audit("Access refused to: " + link + " for " + identity);
}
return new AccessResult(false);
}
use of org.olat.resource.accesscontrol.method.AccessMethodHandler in project OpenOLAT by OpenOLAT.
the class AccessConfigurationController method addConfiguration.
protected void addConfiguration(OfferAccess link) {
AccessMethodHandler handler = acModule.getAccessMethodHandler(link.getMethod().getType());
AccessInfo infos = new AccessInfo(handler.getMethodName(getLocale()), handler.isPaymentMethod(), null, link);
confControllers.add(infos);
if (editable) {
FormLink editLink = uifactory.addFormLink("edit_" + link.getKey(), "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_" + link.getKey(), "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 AccessConfigurationController method editMethod.
private void editMethod(UserRequest ureq, AccessInfo infos) {
OfferAccess link = infos.getLink();
removeAsListenerAndDispose(editMethodCtrl);
AccessMethodHandler handler = acModule.getAccessMethodHandler(link.getMethod().getType());
if (handler != null) {
editMethodCtrl = handler.editConfigurationController(ureq, getWindowControl(), link);
}
if (editMethodCtrl != null) {
listenTo(editMethodCtrl);
String title = handler.getMethodName(getLocale());
cmc = new CloseableModalController(getWindowControl(), translate("close"), editMethodCtrl.getInitialComponent(), true, title);
cmc.activate();
listenTo(cmc);
}
}
Aggregations