use of org.olat.resource.accesscontrol.Offer in project openolat by klemens.
the class PublishProcess method changeAccessAndProperties.
public void changeAccessAndProperties(Identity author, CourseAccessAndProperties accessAndProps) {
RepositoryManager manager = RepositoryManager.getInstance();
manager.setAccessAndProperties(accessAndProps.getRepositoryEntry(), accessAndProps.getAccess(), accessAndProps.isMembersOnly(), accessAndProps.isCanCopy(), accessAndProps.isCanReference(), accessAndProps.isCanDownload());
manager.setLeaveSetting(accessAndProps.getRepositoryEntry(), accessAndProps.getSetting());
List<OfferAccess> offerAccess = accessAndProps.getOfferAccess();
// 1: add new and update existing offerings
ACService acService = CoreSpringFactory.getImpl(ACService.class);
for (OfferAccess newLink : offerAccess) {
if (accessAndProps.getConfirmationEmail() != null) {
Offer offer = newLink.getOffer();
boolean confirmation = accessAndProps.getConfirmationEmail().booleanValue();
if (offer.isConfirmationEmail() != confirmation) {
offer.setConfirmationEmail(confirmation);
if (offer.getKey() != null) {
offer = acService.save(offer);
}
}
}
acService.saveOfferAccess(newLink);
}
// 2: remove offerings not available anymore
List<OfferAccess> deletedOfferAccess = accessAndProps.getDeletedOfferAccess();
for (OfferAccess deletedLink : deletedOfferAccess) {
acService.deletedLinkToMethod(deletedLink);
}
MultiUserEvent modifiedEvent = new EntryChangedEvent(repositoryEntry, author, Change.modifiedAtPublish, "publish");
CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(modifiedEvent, repositoryEntry);
CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(modifiedEvent, RepositoryService.REPOSITORY_EVENT_ORES);
}
use of org.olat.resource.accesscontrol.Offer in project openolat by klemens.
the class PublishStep01AccessForm method addMethod.
protected void addMethod(UserRequest ureq, AccessMethod method) {
Offer offer = acService.createOffer(resource, displayName);
OfferAccess link = acService.createOfferAccess(offer, method);
removeAsListenerAndDispose(newMethodCtrl);
AccessMethodHandler methodHandler = acModule.getAccessMethodHandler(link.getMethod().getType());
if (methodHandler != null) {
newMethodCtrl = methodHandler.createConfigurationController(ureq, getWindowControl(), link);
}
if (newMethodCtrl != null) {
listenTo(newMethodCtrl);
String title = methodHandler.getMethodName(getLocale());
cmc = new CloseableModalController(getWindowControl(), translate("close"), newMethodCtrl.getInitialComponent(), true, title);
cmc.activate();
listenTo(cmc);
} else {
if (!offerAccess.contains(link)) {
offerAccess.add(link);
}
addConfiguration(link);
}
}
use of org.olat.resource.accesscontrol.Offer in project openolat by klemens.
the class PublishStep01AccessForm method loadConfigurations.
protected void loadConfigurations() {
List<Offer> offers = acService.findOfferByResource(resource, true, null);
for (Offer offer : offers) {
List<OfferAccess> offerAccessList = acService.getOfferAccess(offer, true);
for (OfferAccess access : offerAccessList) {
button_id++;
addConfiguration(access);
}
}
}
Aggregations