Skip to content
Snippets Groups Projects
Commit 43d6cffe authored by gnaegi's avatar gnaegi
Browse files

OO-2093 OO-2094 fix author/co-author listing, add course participant listing

parent a580905c
No related branches found
No related tags found
No related merge requests found
......@@ -40,7 +40,6 @@ import org.olat.basesecurity.BaseSecurity;
import org.olat.basesecurity.BaseSecurityModule;
import org.olat.basesecurity.Constants;
import org.olat.basesecurity.GroupRoles;
import org.olat.basesecurity.PermissionOnResourceable;
import org.olat.basesecurity.SecurityGroup;
import org.olat.basesecurity.events.SingleIdentityChosenEvent;
import org.olat.core.commons.fullWebApp.LayoutMain3ColsController;
......@@ -346,8 +345,8 @@ public class UserAdminMainController extends MainLayoutBasicController implement
else if (uobject.equals("coauthors")) {
activatePaneInDetailView = "edit.uroles";
// special case: use user search controller and search for all users that have author rights
PermissionOnResourceable[] permissions = {new PermissionOnResourceable(Constants.PERMISSION_HASROLE, Constants.ORESOURCE_AUTHOR)};
UsermanagerUserSearchController myCtr = new UsermanagerUserSearchController(ureq, bwControl,null, permissions, null, null, null, Identity.STATUS_VISIBLE_LIMIT, true);
List<Identity> resourceOwners = repositoryService.getIdentitiesWithRole(GroupRoles.owner.name());
UsermanagerUserSearchController myCtr = new UsermanagerUserSearchController(ureq, bwControl, resourceOwners, Identity.STATUS_VISIBLE_LIMIT, true);
addToHistory(ureq, bwControl);
// now subtract users that are in the author group to get the co-authors
SecurityGroup[] secGroup = {securityManager.findSecurityGroupByName(Constants.GROUP_AUTHORS)};
......@@ -359,8 +358,22 @@ public class UserAdminMainController extends MainLayoutBasicController implement
}
else if (uobject.equals("resourceowners")) {
activatePaneInDetailView = "edit.uroles";
PermissionOnResourceable[] permissions = {new PermissionOnResourceable(Constants.PERMISSION_HASROLE, Constants.ORESOURCE_AUTHOR)};
contentCtr = new UsermanagerUserSearchController(ureq, bwControl,null, permissions, null, null, null, Identity.STATUS_VISIBLE_LIMIT, true);
// First get all resource owners (co-authors) ...
List<Identity> resourceOwners = repositoryService.getIdentitiesWithRole(GroupRoles.owner.name());
UsermanagerUserSearchController myCtr = new UsermanagerUserSearchController(ureq, bwControl, resourceOwners, Identity.STATUS_VISIBLE_LIMIT, true);
// ... now add users that are in the author group but don't own a resource yet
SecurityGroup[] secGroup = {securityManager.findSecurityGroupByName(Constants.GROUP_AUTHORS)};
List<Identity> identitiesFromAuthorGroup = securityManager.getVisibleIdentitiesByPowerSearch(null, null, true, secGroup , null, null, null, null);
myCtr.addIdentitiesToSearchResult(ureq, identitiesFromAuthorGroup);
contentCtr = myCtr;
addToHistory(ureq, bwControl);
listenTo(contentCtr);
return contentCtr.getInitialComponent();
}
else if (uobject.equals("courseparticipants")) {
activatePaneInDetailView = "edit.courses";
List<Identity> resourceOwners = repositoryService.getIdentitiesWithRole(GroupRoles.participant.name());
contentCtr = new UsermanagerUserSearchController(ureq, bwControl, resourceOwners, Identity.STATUS_VISIBLE_LIMIT, true);
addToHistory(ureq, bwControl);
listenTo(contentCtr);
return contentCtr.getInitialComponent();
......@@ -639,22 +652,29 @@ public class UserAdminMainController extends MainLayoutBasicController implement
gtnChild.setUserObject("resourceowners");
gtnChild.setAltText(translator.translate("menu.resourceowners.alt"));
gtn3.addChild(gtnChild);
}
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.coursecoach"));
gtnChild.setUserObject("coursecoach");
gtnChild.setAltText(translator.translate("menu.coursecoach.alt"));
gtn3.addChild(gtnChild);
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.courseparticipants"));
gtnChild.setUserObject("courseparticipants");
gtnChild.setAltText(translator.translate("menu.courseparticipants.alt"));
gtn3.addChild(gtnChild);
Boolean canGroupmanagers = BaseSecurityModule.USERMANAGER_CAN_MANAGE_GROUPMANAGERS;
if (canGroupmanagers.booleanValue() || isOlatAdmin) {
if (canGroupmanagers.booleanValue() || isOlatAdmin) {
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.groupmanagergroup"));
gtnChild.setUserObject("groupmanagergroup");
gtnChild.setAltText(translator.translate("menu.groupmanagergroup.alt"));
gtn3.addChild(gtnChild);
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.coursecoach"));
gtnChild.setUserObject("coursecoach");
gtnChild.setAltText(translator.translate("menu.coursecoach.alt"));
gtn3.addChild(gtnChild);
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.groupcoach"));
gtnChild.setUserObject("groupcoach");
......
......@@ -27,7 +27,9 @@ menu.caches.alt=Caches
menu.config=Core Konfiguration
menu.config.alt=Konfigurieren Sie ihr Core Funktionen
menu.coursecoach=Kursbetreuer
menu.coursecoach.alt=Kursbetreuer
menu.coursecoach.alt=Alle Benutzer die in mindestens einem Kurs als Betreuer eingetragen sind
menu.courseparticipants=Kursteilnehmer
menu.courseparticipants.alt=Alle Benutzer die in mindestens einem Kurs als Teilnehmer eingetragen sind
menu.cluster=Clustering
menu.cluster.alt=Clustering
menu.created.lastmonth=Neu seit 1 Monat
......
......@@ -29,7 +29,9 @@ menu.coauthors.alt=Manage all co-authors that are not part of the author group
menu.config=Core functions
menu.config.alt=Configure your system's core functions
menu.coursecoach=Course coach
menu.coursecoach.alt=Course coach
menu.coursecoach.alt=All users that have the coach role in at least one course
menu.courseparticipants=Course participants
menu.courseparticipants.alt=All users that are enrolled as participants in at least one course
menu.created.lastmonth=New since last month
menu.created.lastmonth.alt=Users that have been created within the last month
menu.created.lastweek=New since last week
......
......@@ -241,6 +241,7 @@ public class UsermanagerUserSearchController extends BasicController implements
userListVC.contextPut("showBackButton", Boolean.FALSE);
userListVC.contextPut("showTitle", Boolean.TRUE);
this.identitiesList = identitiesList;
initUserListCtr(ureq, identitiesList, status);
userListVC.put("userlist", tableCtr.getInitialComponent());
userListVC.contextPut("emptyList", (identitiesList.size() == 0 ? Boolean.TRUE : Boolean.FALSE));
......@@ -343,6 +344,31 @@ public class UsermanagerUserSearchController extends BasicController implements
userListVC.put("userlist", tableCtr.getInitialComponent());
}
/**
* Add the given identities to the list of identities in the table model
* and reinitialize the table controller
*
* @param ureq
* @param tobeAddedIdentities
*/
public void addIdentitiesToSearchResult(UserRequest ureq, List<Identity> tobeAddedIdentities) {
for (Identity toBeAdded : tobeAddedIdentities) {
boolean found = false;
for (Identity original : identitiesList) {
if (original.getKey().equals(toBeAdded.getKey())) {
found = true;
break;
}
}
if (!found) {
identitiesList.add(toBeAdded);
}
}
initUserListCtr(ureq, identitiesList, null);
userListVC.put("userlist", tableCtr.getInitialComponent());
}
/**
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
* org.olat.core.gui.components.Component,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment