use of org.olat.repository.model.RepositoryEntryPermissionChangeEvent in project openolat by klemens.
the class RepositoryMembersController method addMembers.
protected void addMembers(UserRequest ureq, StepsRunContext runContext) {
@SuppressWarnings("unchecked") List<Identity> members = (List<Identity>) runContext.get("members");
MailTemplate template = (MailTemplate) runContext.get("mailTemplate");
MemberPermissionChangeEvent changes = (MemberPermissionChangeEvent) runContext.get("permissions");
// commit changes to the repository entry
MailerResult result = new MailerResult();
MailPackage reMailing = new MailPackage(template, result, getWindowControl().getBusinessControl().getAsString(), template != null);
List<RepositoryEntryPermissionChangeEvent> repoChanges = changes.generateRepositoryChanges(members);
repositoryManager.updateRepositoryEntryMemberships(getIdentity(), ureq.getUserSession().getRoles(), repoEntry, repoChanges, reMailing);
// commit all changes to the group memberships
List<BusinessGroupMembershipChange> allModifications = changes.generateBusinessGroupMembershipChange(members);
MailPackage bgMailing = new MailPackage(template, result, getWindowControl().getBusinessControl().getAsString(), template != null);
businessGroupService.updateMemberships(getIdentity(), allModifications, bgMailing);
MailHelper.printErrorsAndWarnings(result, getWindowControl(), ureq.getUserSession().getRoles().isOLATAdmin(), getLocale());
}
use of org.olat.repository.model.RepositoryEntryPermissionChangeEvent in project openolat by klemens.
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 klemens.
the class MembersOverviewController method addMembers.
protected void addMembers(UserRequest ureq, StepsRunContext runContext) {
@SuppressWarnings("unchecked") List<Identity> members = (List<Identity>) runContext.get("members");
MemberPermissionChangeEvent changes = (MemberPermissionChangeEvent) runContext.get("permissions");
MailTemplate template = (MailTemplate) runContext.get("mailTemplate");
// commit changes to the repository entry
MailerResult result = new MailerResult();
MailPackage reMailing = new MailPackage(template, result, getWindowControl().getBusinessControl().getAsString(), template != null);
Roles roles = ureq.getUserSession().getRoles();
List<RepositoryEntryPermissionChangeEvent> repoChanges = changes.generateRepositoryChanges(members);
repositoryManager.updateRepositoryEntryMemberships(getIdentity(), roles, repoEntry, repoChanges, reMailing);
// commit all changes to the group memberships
List<BusinessGroupMembershipChange> allModifications = changes.generateBusinessGroupMembershipChange(members);
MailPackage mailing = new MailPackage(template, result, getWindowControl().getBusinessControl().getAsString(), template != null);
businessGroupService.updateMemberships(getIdentity(), allModifications, mailing);
MailHelper.printErrorsAndWarnings(result, getWindowControl(), roles.isOLATAdmin(), getLocale());
switchToAllMembers(ureq);
}
use of org.olat.repository.model.RepositoryEntryPermissionChangeEvent in project openolat by klemens.
the class AbstractMemberListController method doChangePermission.
protected void doChangePermission(UserRequest ureq, MemberPermissionChangeEvent changes, List<Identity> members, boolean sendMail) {
MailPackage mailing = new MailPackage(sendMail);
if (repoEntry != null) {
List<RepositoryEntryPermissionChangeEvent> repoChanges = changes.generateRepositoryChanges(members);
repositoryManager.updateRepositoryEntryMemberships(getIdentity(), ureq.getUserSession().getRoles(), repoEntry, repoChanges, mailing);
}
// commit all changes to the group memberships
List<BusinessGroupMembershipChange> allModifications = changes.generateBusinessGroupMembershipChange(members);
businessGroupService.updateMemberships(getIdentity(), allModifications, mailing);
reloadModel();
}
Aggregations