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

OO-4484: reduce list of dispense to the profiled identity in profile

parent 90657497
No related branches found
No related tags found
No related merge requests found
......@@ -110,6 +110,7 @@ public class AbsenceNoticesListController extends FormBasicController {
* Show per default the start / end date as whole date
*/
private final boolean wholeDateDefault;
private final boolean withUserProperties;
private final boolean isAdministrativeUser;
private final List<UserPropertyHandler> userPropertyHandlers;
private final LecturesSecurityCallback secCallback;
......@@ -134,7 +135,8 @@ public class AbsenceNoticesListController extends FormBasicController {
private BaseSecurityModule securityModule;
public AbsenceNoticesListController(UserRequest ureq, WindowControl wControl, Date currentDate,
boolean authorizedEnabled, LecturesSecurityCallback secCallback, String tableId) {
boolean authorizedEnabled, LecturesSecurityCallback secCallback, boolean withUserProperties,
String tableId) {
super(ureq, wControl, "absences_list", Util.createPackageTranslator(LectureRepositoryAdminController.class, ureq.getLocale()));
setTranslator(userManager.getPropertyHandlerTranslator(getTranslator()));
this.tableId = tableId;
......@@ -142,6 +144,7 @@ public class AbsenceNoticesListController extends FormBasicController {
this.currentDate = currentDate;
wholeDateDefault = (currentDate == null);
this.authorizedEnabled = authorizedEnabled;
this.withUserProperties = withUserProperties;
isAdministrativeUser = securityModule.isUserAllowedAdminProps(ureq.getUserSession().getRoles());
userPropertyHandlers = userManager.getUserPropertyHandlersFor(USER_USAGE_IDENTIFIER, isAdministrativeUser);
......@@ -167,7 +170,9 @@ public class AbsenceNoticesListController extends FormBasicController {
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, NoticeCols.id));
initUserColumns(columnsModel);
if(withUserProperties) {
initUserColumns(columnsModel);
}
initColumns(columnsModel);
tableModel = new AbsenceNoticesListTableModel(columnsModel, userManager, userPropertyHandlers, getLocale());
......
......@@ -85,7 +85,7 @@ public class AbsencesController extends BasicController {
searchCtrl = new AbsenceNoticeSearchController(ureq, getWindowControl(), currentDate);
listenTo(searchCtrl);
noticesListCtlr = new AbsenceNoticesListController(ureq, getWindowControl(),
null, true, secCallback, "absences");
null, true, secCallback, true, "absences");
listenTo(noticesListCtlr);
mainVC = createVelocityContainer("absences");
......
......@@ -67,7 +67,7 @@ public class DailyAbsencesController extends BasicController {
searchParams.setParticipant(profiledIdentity);
}
noticesListCtlr = new AbsenceNoticesListController(ureq, getWindowControl(),
currentDate, true, secCallback, "daily");
currentDate, true, secCallback, true, "daily");
listenTo(noticesListCtlr);
mainVC = createVelocityContainer("daily_absences");
......
......@@ -33,6 +33,7 @@ import org.olat.core.gui.control.WindowControl;
import org.olat.core.gui.control.controller.BasicController;
import org.olat.core.gui.control.generic.wizard.StepRunnerCallback;
import org.olat.core.gui.control.generic.wizard.StepsMainRunController;
import org.olat.core.id.Identity;
import org.olat.core.util.Util;
import org.olat.modules.lecture.AbsenceNoticeSearchParameters;
import org.olat.modules.lecture.AbsenceNoticeType;
......@@ -64,8 +65,34 @@ public class DispensationsController extends BasicController {
private AbsenceNoticeSearchController searchCtrl;
private AbsenceNoticesListController noticesListCtlr;
/**
* Show a list of dispense (type notified or dispensation).
*
* @param ureq The user request
* @param wControl The window control
* @param currentDate The date to restrict the list
* @param secCallback The security callback
* @param withSearch With search
* @param withAddAbsence With button the add absence (if allowed by security callback)
*/
public DispensationsController(UserRequest ureq, WindowControl wControl, Date currentDate,
LecturesSecurityCallback secCallback, boolean withSearch, boolean withAddAbsence) {
this(ureq, wControl, currentDate, secCallback, null, withSearch, withAddAbsence);
}
/**
* Show a list of dispense (type notified or dispensation).
*
* @param ureq The user request
* @param wControl The window control
* @param currentDate The date to restrict the list
* @param secCallback The security callback
* @param profiledIdentity Limit to a single identity (can be null)
* @param withSearch With search
* @param withAddAbsence With button the add absence (if allowed by security callback)
*/
public DispensationsController(UserRequest ureq, WindowControl wControl, Date currentDate,
LecturesSecurityCallback secCallback, Identity profiledIdentity, boolean withSearch, boolean withAddAbsence) {
super(ureq, wControl, Util.createPackageTranslator(LectureRepositoryAdminController.class, ureq.getLocale()));
this.secCallback = secCallback;
......@@ -76,11 +103,13 @@ public class DispensationsController extends BasicController {
searchParams.setLinkedToRollCall(false);
searchParams.setStartDate(CalendarUtils.startOfDay(currentDate));
searchParams.setEndDate(CalendarUtils.endOfDay(currentDate));
searchParams.setParticipant(profiledIdentity);
searchCtrl = new AbsenceNoticeSearchController(ureq, getWindowControl(), currentDate);
listenTo(searchCtrl);
boolean showUserProperties = profiledIdentity == null;
noticesListCtlr = new AbsenceNoticesListController(ureq, getWindowControl(),
null, false, secCallback, "notices");
null, false, secCallback, showUserProperties, "notices");
listenTo(noticesListCtlr);
mainVC = createVelocityContainer("dispensations");
......
......@@ -159,7 +159,7 @@ public class IdentityProfileController extends BasicController implements Activa
// dispensation
if(lectureModule.isAbsenceNoticeEnabled()) {
dispensationsTab = tabPane.addTab(translate("user.overview.dispensation"), uureq -> {
dispensationsCtrl = new DispensationsController(uureq, getWindowControl(), null, secCallback, false, false);
dispensationsCtrl = new DispensationsController(uureq, getWindowControl(), null, secCallback, profiledIdentity, false, false);
listenTo(dispensationsCtrl);
return dispensationsCtrl.getInitialComponent();
});
......
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