Search in sources :

Example 11 with MemberPermissionChangeEvent

use of org.olat.group.ui.main.MemberPermissionChangeEvent 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);
}
Also used : MailPackage(org.olat.core.util.mail.MailPackage) MailerResult(org.olat.core.util.mail.MailerResult) MemberPermissionChangeEvent(org.olat.group.ui.main.MemberPermissionChangeEvent) Roles(org.olat.core.id.Roles) RepositoryEntryPermissionChangeEvent(org.olat.repository.model.RepositoryEntryPermissionChangeEvent) BusinessGroupMembershipChange(org.olat.group.model.BusinessGroupMembershipChange) MailTemplate(org.olat.core.util.mail.MailTemplate) List(java.util.List) Identity(org.olat.core.id.Identity)

Example 12 with MemberPermissionChangeEvent

use of org.olat.group.ui.main.MemberPermissionChangeEvent in project openolat by klemens.

the class BusinessGroupMembersController method addMembers.

private void addMembers(StepsRunContext runContext) {
    @SuppressWarnings("unchecked") List<Identity> members = (List<Identity>) runContext.get("members");
    MemberPermissionChangeEvent changes = (MemberPermissionChangeEvent) runContext.get("permissions");
    // commit all changes to the group memberships
    List<BusinessGroupMembershipChange> allModifications = changes.generateBusinessGroupMembershipChange(members);
    MailTemplate template = (MailTemplate) runContext.get("mailTemplate");
    MailPackage mailing = new MailPackage(template, getWindowControl().getBusinessControl().getAsString(), template != null);
    businessGroupService.updateMemberships(getIdentity(), allModifications, mailing);
    MailHelper.printErrorsAndWarnings(mailing.getResult(), getWindowControl(), false, getLocale());
}
Also used : BusinessGroupMembershipChange(org.olat.group.model.BusinessGroupMembershipChange) MailPackage(org.olat.core.util.mail.MailPackage) MemberPermissionChangeEvent(org.olat.group.ui.main.MemberPermissionChangeEvent) MailTemplate(org.olat.core.util.mail.MailTemplate) List(java.util.List) Identity(org.olat.core.id.Identity)

Aggregations

MemberPermissionChangeEvent (org.olat.group.ui.main.MemberPermissionChangeEvent)12 List (java.util.List)8 Identity (org.olat.core.id.Identity)6 MailPackage (org.olat.core.util.mail.MailPackage)6 MailTemplate (org.olat.core.util.mail.MailTemplate)6 BusinessGroupMembershipChange (org.olat.group.model.BusinessGroupMembershipChange)6 MailerResult (org.olat.core.util.mail.MailerResult)4 RepositoryEntryPermissionChangeEvent (org.olat.repository.model.RepositoryEntryPermissionChangeEvent)4 ArrayList (java.util.ArrayList)2 TableEvent (org.olat.core.gui.components.table.TableEvent)2 TableMultiSelectEvent (org.olat.core.gui.components.table.TableMultiSelectEvent)2 Roles (org.olat.core.id.Roles)2 BusinessGroup (org.olat.group.BusinessGroup)2 RepositoryEntry (org.olat.repository.RepositoryEntry)2