Skip to content
Snippets Groups Projects
Commit aad71dd4 authored by srosse's avatar srosse
Browse files

OO-1495: filter by ownership too

parent faebb770
No related branches found
No related tags found
No related merge requests found
......@@ -661,16 +661,31 @@ public class AuthorListController extends FormBasicController implements Activat
private void doAddOwners(UserRequest ureq, List<AuthoringEntryRow> rows) {
if(userSearchCtr != null) return;
removeAsListenerAndDispose(userSearchCtr);
userSearchCtr = new UserSearchController(ureq, getWindowControl(), false, true, UserSearchController.ACTION_KEY_CHOOSE_FINISH);
userSearchCtr.setUserObject(rows);
listenTo(userSearchCtr);
Roles roles = ureq.getUserSession().getRoles();
List<AuthoringEntryRow> manageableRows = new ArrayList<>(rows.size());
for(AuthoringEntryRow row:rows) {
boolean managed = RepositoryEntryManagedFlag.isManaged(row.getManagedFlags(), RepositoryEntryManagedFlag.membersmanagement);
boolean canAddOwner = roles.isOLATAdmin() || repositoryService.hasRole(ureq.getIdentity(), row, GroupRoles.owner.name())
|| repositoryManager.isInstitutionalRessourceManagerFor(getIdentity(), roles, row);
if(canAddOwner && !managed) {
manageableRows.add(row);
}
}
String title = translate("tools.add.owners");
cmc = new CloseableModalController(getWindowControl(), translate("close"), userSearchCtr.getInitialComponent(),
true, title);
listenTo(cmc);
cmc.activate();
if(manageableRows.isEmpty()) {
showWarning("bulk.update.nothing.selected");
} else {
removeAsListenerAndDispose(userSearchCtr);
userSearchCtr = new UserSearchController(ureq, getWindowControl(), false, true, UserSearchController.ACTION_KEY_CHOOSE_FINISH);
userSearchCtr.setUserObject(manageableRows);
listenTo(userSearchCtr);
String title = translate("tools.add.owners");
cmc = new CloseableModalController(getWindowControl(), translate("close"), userSearchCtr.getInitialComponent(),
true, title);
listenTo(cmc);
cmc.activate();
}
}
private void doAddOwners(List<Identity> futureOwners, List<AuthoringEntryRow> rows) {
......@@ -683,7 +698,6 @@ public class AuthorListController extends FormBasicController implements Activat
}
private void doConfirmCopy(UserRequest ureq, List<AuthoringEntryRow> rows) {
Roles roles = ureq.getUserSession().getRoles();
List<AuthoringEntryRow> copyableRows = new ArrayList<>(rows.size());
for(AuthoringEntryRow row:rows) {
......
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