Search in sources :

Example 1 with RepositoryEntryPermissionChangeEvent

use of org.olat.repository.model.RepositoryEntryPermissionChangeEvent in project OpenOLAT by OpenOLAT.

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();
}
Also used : MailPackage(org.olat.core.util.mail.MailPackage) RepositoryEntryPermissionChangeEvent(org.olat.repository.model.RepositoryEntryPermissionChangeEvent)

Example 2 with RepositoryEntryPermissionChangeEvent

use of org.olat.repository.model.RepositoryEntryPermissionChangeEvent in project OpenOLAT by OpenOLAT.

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 3 with RepositoryEntryPermissionChangeEvent

use of org.olat.repository.model.RepositoryEntryPermissionChangeEvent in project OpenOLAT by OpenOLAT.

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

Example 4 with RepositoryEntryPermissionChangeEvent

use of org.olat.repository.model.RepositoryEntryPermissionChangeEvent in project OpenOLAT by OpenOLAT.

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();
}
Also used : BusinessGroupMembershipChange(org.olat.group.model.BusinessGroupMembershipChange) MailPackage(org.olat.core.util.mail.MailPackage) RepositoryEntryPermissionChangeEvent(org.olat.repository.model.RepositoryEntryPermissionChangeEvent)

Example 5 with RepositoryEntryPermissionChangeEvent

use of org.olat.repository.model.RepositoryEntryPermissionChangeEvent in project openolat by klemens.

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();
}
Also used : MailPackage(org.olat.core.util.mail.MailPackage) RepositoryEntryPermissionChangeEvent(org.olat.repository.model.RepositoryEntryPermissionChangeEvent)

Aggregations

RepositoryEntryPermissionChangeEvent (org.olat.repository.model.RepositoryEntryPermissionChangeEvent)14 MailPackage (org.olat.core.util.mail.MailPackage)12 MailerResult (org.olat.core.util.mail.MailerResult)6 BusinessGroupMembershipChange (org.olat.group.model.BusinessGroupMembershipChange)6 List (java.util.List)4 Identity (org.olat.core.id.Identity)4 MailTemplate (org.olat.core.util.mail.MailTemplate)4 MemberPermissionChangeEvent (org.olat.group.ui.main.MemberPermissionChangeEvent)4 ArrayList (java.util.ArrayList)2 Roles (org.olat.core.id.Roles)2 RepositoryEntry (org.olat.repository.RepositoryEntry)2 RepositoryEntryMembershipModifiedEvent (org.olat.repository.model.RepositoryEntryMembershipModifiedEvent)2