use of org.olat.admin.securitygroup.gui.IdentitiesRemoveEvent in project OpenOLAT by OpenOLAT.
the class CatalogNodeManagerController method doAddRemoveOwners.
private void doAddRemoveOwners(Event event) {
if (event instanceof IdentitiesAddEvent) {
IdentitiesAddEvent identitiesAddedEvent = (IdentitiesAddEvent) event;
List<Identity> list = identitiesAddedEvent.getAddIdentities();
for (Identity identity : list) {
if (!securityManager.isIdentityInSecurityGroup(identity, catalogEntry.getOwnerGroup())) {
securityManager.addIdentityToSecurityGroup(identity, catalogEntry.getOwnerGroup());
identitiesAddedEvent.getAddedIdentities().add(identity);
}
}
} else if (event instanceof IdentitiesRemoveEvent) {
IdentitiesRemoveEvent identitiesRemoveEvent = (IdentitiesRemoveEvent) event;
List<Identity> list = identitiesRemoveEvent.getRemovedIdentities();
for (Identity identity : list) {
securityManager.removeIdentityFromSecurityGroup(identity, catalogEntry.getOwnerGroup());
}
}
}
use of org.olat.admin.securitygroup.gui.IdentitiesRemoveEvent in project OpenOLAT by OpenOLAT.
the class CatalogNodeManagerController method event.
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
if (addEntryCtrl == source) {
if (event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
loadNodesChildren();
}
cmc.deactivate();
cleanUp();
fireEvent(ureq, Event.CHANGED_EVENT);
} else if (editEntryCtrl == source) {
if (event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
catalogEntry = editEntryCtrl.getEditedCatalogEntry();
loadEntryInfos();
}
cmc.deactivate();
cleanUp();
fireEvent(ureq, Event.CHANGED_EVENT);
} else if (categoryMoveCtrl == source) {
cmc.deactivate();
CatalogEntry moveMe = null;
if (event.equals(Event.DONE_EVENT)) {
showInfo("tools.move.catalog.entry.success", catalogEntry.getName());
moveMe = categoryMoveCtrl.getMoveMe();
} else if (event.equals(Event.FAILED_EVENT)) {
showError("tools.move.catalog.entry.failed");
loadNodesChildren();
}
cleanUp();
// in any case, remove the lock
if (catModificationLock != null && catModificationLock.isSuccess()) {
CoordinatorManager.getInstance().getCoordinator().getLocker().releaseLock(catModificationLock);
catModificationLock = null;
}
// only after jump to the moved entry
if (moveMe != null) {
launchCatalogEntry(ureq, moveMe);
}
} else if (dialogDeleteSubtree == source) {
// from remove subtree dialog -> yes or no
if (DialogBoxUIFactory.isYesEvent(event)) {
catalogManager.deleteCatalogEntry(catalogEntry);
fireEvent(ureq, Event.BACK_EVENT);
}
// in any case, remove the lock
if (catModificationLock != null && catModificationLock.isSuccess()) {
CoordinatorManager.getInstance().getCoordinator().getLocker().releaseLock(catModificationLock);
catModificationLock = null;
}
} else if (childNodeCtrl == source) {
if (event == Event.BACK_EVENT) {
toolbarPanel.popUpToController(this);
removeAsListenerAndDispose(childNodeCtrl);
childNodeCtrl = null;
loadNodesChildren();
}
} else if (entrySearchCtrl == source) {
if (event.getCommand().equals(RepositoryTableModel.TABLE_ACTION_SELECT_LINK)) {
// successfully selected a repository entry which will be a link within
// the current Category
RepositoryEntry selectedEntry = entrySearchCtrl.getSelectedEntry();
doAddResource(ureq, selectedEntry);
fireEvent(ureq, Event.CHANGED_EVENT);
}
cmc.deactivate();
cleanUp();
} else if (groupCtrl == source) {
if (event instanceof IdentitiesAddEvent || event instanceof IdentitiesRemoveEvent) {
doAddRemoveOwners(event);
}
} else if (contactCtrl == source) {
cmc.deactivate();
cleanUp();
} else if (dialogDeleteLink == source) {
if (DialogBoxUIFactory.isYesEvent(event)) {
CatalogEntryRow row = (CatalogEntryRow) dialogDeleteLink.getUserObject();
catalogManager.deleteCatalogEntry(row, catalogEntry);
loadResources(ureq);
}
} else if (entryResourceMoveCtrl == source) {
if (event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
CatalogEntry moveMe = entryResourceMoveCtrl.getMoveMe();
showInfo("tools.move.catalog.entry.success", moveMe.getName());
loadResources(ureq);
}
cmc.deactivate();
cleanUp();
} else if (cmc == source) {
cleanUp();
}
super.event(ureq, source, event);
}
use of org.olat.admin.securitygroup.gui.IdentitiesRemoveEvent in project OpenOLAT by OpenOLAT.
the class GroupController method doRemoveIdentitiesFromGroup.
private void doRemoveIdentitiesFromGroup(UserRequest ureq, List<Identity> toBeRemoved, MailTemplate mailTemplate) {
fireEvent(ureq, new IdentitiesRemoveEvent(toBeRemoved));
identitiesTableModel.remove(toBeRemoved);
if (tableCtr != null) {
// can be null in the follwoing case.
// the user which does the removal is also in the list of toBeRemoved
// hence the fireEvent does trigger a disposal of a GroupController, which
// in turn nullifies the tableCtr... see also OLAT-3331
tableCtr.modelChanged();
}
// send the notification mail
if (mailTemplate != null) {
// means no sender in footer
Identity sender = null;
if (showSenderInRemovMailFooter) {
sender = ureq.getIdentity();
}
String metaId = UUID.randomUUID().toString();
MailContext context = new MailContextImpl(getWindowControl().getBusinessControl().getAsString());
MailerResult result = new MailerResult();
MailBundle[] bundles = mailManager.makeMailBundles(context, toBeRemoved, mailTemplate, sender, metaId, result);
result.append(mailManager.sendMessage(bundles));
if (mailTemplate.getCpfrom()) {
MailBundle ccBundle = mailManager.makeMailBundle(context, ureq.getIdentity(), mailTemplate, sender, metaId, result);
result.append(mailManager.sendMessage(ccBundle));
}
MailHelper.printErrorsAndWarnings(result, getWindowControl(), ureq.getUserSession().getRoles().isOLATAdmin(), ureq.getLocale());
}
}
use of org.olat.admin.securitygroup.gui.IdentitiesRemoveEvent in project openolat by klemens.
the class CatalogNodeManagerController method doAddRemoveOwners.
private void doAddRemoveOwners(Event event) {
if (event instanceof IdentitiesAddEvent) {
IdentitiesAddEvent identitiesAddedEvent = (IdentitiesAddEvent) event;
List<Identity> list = identitiesAddedEvent.getAddIdentities();
for (Identity identity : list) {
if (!securityManager.isIdentityInSecurityGroup(identity, catalogEntry.getOwnerGroup())) {
securityManager.addIdentityToSecurityGroup(identity, catalogEntry.getOwnerGroup());
identitiesAddedEvent.getAddedIdentities().add(identity);
}
}
} else if (event instanceof IdentitiesRemoveEvent) {
IdentitiesRemoveEvent identitiesRemoveEvent = (IdentitiesRemoveEvent) event;
List<Identity> list = identitiesRemoveEvent.getRemovedIdentities();
for (Identity identity : list) {
securityManager.removeIdentityFromSecurityGroup(identity, catalogEntry.getOwnerGroup());
}
}
}
use of org.olat.admin.securitygroup.gui.IdentitiesRemoveEvent in project openolat by klemens.
the class RightsMetadataEditController method event.
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
if (source == groupController) {
if (event instanceof IdentitiesAddEvent) {
IdentitiesAddEvent identitiesAddedEvent = (IdentitiesAddEvent) event;
List<Identity> list = identitiesAddedEvent.getAddIdentities();
qpoolService.addAuthors(list, Collections.<QuestionItemShort>singletonList(item));
identitiesAddedEvent.getAddedIdentities().addAll(list);
} else if (event instanceof IdentitiesRemoveEvent) {
IdentitiesRemoveEvent identitiesRemoveEvent = (IdentitiesRemoveEvent) event;
List<Identity> list = identitiesRemoveEvent.getRemovedIdentities();
qpoolService.removeAuthors(list, Collections.<QuestionItemShort>singletonList(item));
}
reloadAuthors();
// cmc.deactivate();
// cleanUp();
} else if (source == cmc) {
fireEvent(ureq, new QItemEdited(item));
cleanUp();
}
super.event(ureq, source, event);
}
Aggregations