use of org.olat.repository.model.RepositoryEntryPermissionChangeEvent in project openolat by klemens.
the class CourseOverviewController method doChangePermission.
private void doChangePermission(UserRequest ureq, MemberPermissionChangeEvent e, RepositoryEntry re, boolean sendMail) {
MailPackage mailing = new MailPackage(sendMail);
if (re != null) {
List<RepositoryEntryPermissionChangeEvent> changes = Collections.singletonList((RepositoryEntryPermissionChangeEvent) e);
repositoryManager.updateRepositoryEntryMemberships(getIdentity(), ureq.getUserSession().getRoles(), re, changes, mailing);
}
businessGroupService.updateMemberships(getIdentity(), e.getGroupChanges(), mailing);
// make sure all is committed before loading the model again (I see issues without)
DBFactory.getInstance().commitAndCloseSession();
updateModel();
}
use of org.olat.repository.model.RepositoryEntryPermissionChangeEvent in project openolat by klemens.
the class CourseOverviewController method doAddToRepositoryEntry.
private void doAddToRepositoryEntry(UserRequest ureq, Collection<RepositoryEntry> res, SearchType type, boolean sendEmail) {
// commit changes to the repository entry
MailerResult result = new MailerResult();
MailPackage reMailing = new MailPackage(result, getWindowControl().getBusinessControl().getAsString(), sendEmail);
RepositoryEntryPermissionChangeEvent changeEvent = new RepositoryEntryPermissionChangeEvent(editedIdentity);
switch(type) {
case owner:
changeEvent.setRepoOwner(Boolean.TRUE);
break;
case tutor:
changeEvent.setRepoTutor(Boolean.TRUE);
break;
case participant:
changeEvent.setRepoParticipant(Boolean.TRUE);
break;
}
List<RepositoryEntryPermissionChangeEvent> repoChanges = Collections.singletonList(changeEvent);
for (RepositoryEntry repoEntry : res) {
repositoryManager.updateRepositoryEntryMemberships(getIdentity(), ureq.getUserSession().getRoles(), repoEntry, repoChanges, reMailing);
}
// make sure all is committed before loading the model again (I see issues without)
DBFactory.getInstance().commitAndCloseSession();
MailHelper.printErrorsAndWarnings(result, getWindowControl(), ureq.getUserSession().getRoles().isOLATAdmin(), getLocale());
}
use of org.olat.repository.model.RepositoryEntryPermissionChangeEvent in project OpenOLAT by OpenOLAT.
the class RepositoryManager method updateRepositoryEntryMemberships.
public void updateRepositoryEntryMemberships(Identity ureqIdentity, Roles ureqRoles, RepositoryEntry re, List<RepositoryEntryPermissionChangeEvent> changes, MailPackage mailing) {
int count = 0;
List<RepositoryEntryMembershipModifiedEvent> deferredEvents = new ArrayList<>();
for (RepositoryEntryPermissionChangeEvent e : changes) {
updateRepositoryEntryMembership(ureqIdentity, ureqRoles, re, e, mailing, deferredEvents);
if (++count % 100 == 0) {
dbInstance.commitAndCloseSession();
}
}
dbInstance.commitAndCloseSession();
sendDeferredEvents(deferredEvents, re);
}
use of org.olat.repository.model.RepositoryEntryPermissionChangeEvent in project OpenOLAT by OpenOLAT.
the class CourseOverviewController method doAddToRepositoryEntry.
private void doAddToRepositoryEntry(UserRequest ureq, Collection<RepositoryEntry> res, SearchType type, boolean sendEmail) {
// commit changes to the repository entry
MailerResult result = new MailerResult();
MailPackage reMailing = new MailPackage(result, getWindowControl().getBusinessControl().getAsString(), sendEmail);
RepositoryEntryPermissionChangeEvent changeEvent = new RepositoryEntryPermissionChangeEvent(editedIdentity);
switch(type) {
case owner:
changeEvent.setRepoOwner(Boolean.TRUE);
break;
case tutor:
changeEvent.setRepoTutor(Boolean.TRUE);
break;
case participant:
changeEvent.setRepoParticipant(Boolean.TRUE);
break;
}
List<RepositoryEntryPermissionChangeEvent> repoChanges = Collections.singletonList(changeEvent);
for (RepositoryEntry repoEntry : res) {
repositoryManager.updateRepositoryEntryMemberships(getIdentity(), ureq.getUserSession().getRoles(), repoEntry, repoChanges, reMailing);
}
// make sure all is committed before loading the model again (I see issues without)
DBFactory.getInstance().commitAndCloseSession();
MailHelper.printErrorsAndWarnings(result, getWindowControl(), ureq.getUserSession().getRoles().isOLATAdmin(), getLocale());
}
use of org.olat.repository.model.RepositoryEntryPermissionChangeEvent in project OpenOLAT by OpenOLAT.
the class AbstractMemberListController method doChangePermission.
protected void doChangePermission(UserRequest ureq, MemberPermissionChangeEvent e, boolean sendMail) {
MailPackage mailing = new MailPackage(sendMail);
if (repoEntry != null) {
List<RepositoryEntryPermissionChangeEvent> changes = Collections.singletonList((RepositoryEntryPermissionChangeEvent) e);
repositoryManager.updateRepositoryEntryMemberships(getIdentity(), ureq.getUserSession().getRoles(), repoEntry, changes, mailing);
}
businessGroupService.updateMemberships(getIdentity(), e.getGroupChanges(), mailing);
// make sure all is committed before loading the model again (I see issues without)
DBFactory.getInstance().commitAndCloseSession();
reloadModel();
}
Aggregations