diff --git a/src/main/java/org/olat/admin/user/UserAdminController.java b/src/main/java/org/olat/admin/user/UserAdminController.java index 8742a1cd33f9f9f5f136a2457cf35a018c7adf8d..a197408fed316515775b48f8f5918c2774a6c298 100644 --- a/src/main/java/org/olat/admin/user/UserAdminController.java +++ b/src/main/java/org/olat/admin/user/UserAdminController.java @@ -31,7 +31,6 @@ import org.olat.admin.user.course.CourseOverviewController; import org.olat.admin.user.groups.GroupOverviewController; import org.olat.basesecurity.Authentication; import org.olat.basesecurity.BaseSecurity; -import org.olat.basesecurity.BaseSecurityManager; import org.olat.basesecurity.BaseSecurityModule; import org.olat.basesecurity.Constants; import org.olat.basesecurity.SecurityGroup; @@ -61,6 +60,8 @@ import org.olat.core.util.vfs.QuotaManager; import org.olat.course.certificate.ui.CertificateAndEfficiencyStatementListController; import org.olat.ldap.LDAPLoginManager; import org.olat.ldap.LDAPLoginModule; +import org.olat.modules.lecture.LectureModule; +import org.olat.modules.lecture.ui.ParticipantLecturesOverviewController; import org.olat.properties.Property; import org.olat.user.ChangePrefsController; import org.olat.user.DisplayPortraitController; @@ -95,8 +96,9 @@ public class UserAdminController extends BasicController implements Activateable private static final String NLS_EDIT_UQUOTA = "edit.uquota"; private static final String NLS_VIEW_GROUPS = "view.groups"; private static final String NLS_VIEW_COURSES = "view.courses"; - private static final String NLS_VIEW_EFF_STATEMENTS = "view.effStatements"; - private static final String NLS_VIEW_SUBSCRIPTIONS = "view.subscriptions"; + private static final String NLS_VIEW_EFF_STATEMENTS = "view.effStatements"; + private static final String NLS_VIEW_SUBSCRIPTIONS = "view.subscriptions"; + private static final String NLS_VIEW_LECTURES = "view.lectures"; private VelocityContainer myContent; @@ -111,6 +113,7 @@ public class UserAdminController extends BasicController implements Activateable private ProfileAndHomePageEditController userProfileCtr; private CourseOverviewController courseCtr; private GroupOverviewController grpCtr; + private ParticipantLecturesOverviewController lecturesCtrl; private CertificateAndEfficiencyStatementListController efficicencyCtrl; private final boolean isOlatAdmin; @@ -121,6 +124,8 @@ public class UserAdminController extends BasicController implements Activateable private LDAPLoginModule ldapLoginModule; @Autowired private LDAPLoginManager ldapLoginManager; + @Autowired + private LectureModule lectureModule; /** * Constructor that creates a back - link as default @@ -231,34 +236,44 @@ public class UserAdminController extends BasicController implements Activateable * @return boolean */ private boolean allowedToManageUser(UserRequest ureq, Identity identity) { - //fxdiff FXOLAT-184 prevent editing of users that are in frentix-superadmin group (except "frentix" wants to change own profile) + // prevent editing of users that are in frentix-superadmin group (except "frentix" wants to change own profile) Identity editor = ureq.getUserSession().getIdentity(); - SecurityGroup frentixSuperAdminGroup = BaseSecurityManager.getInstance().findSecurityGroupByName("fxadmins"); - if(BaseSecurityManager.getInstance().isIdentityInSecurityGroup(identity, frentixSuperAdminGroup)){ - if(editor.equals(identity) || BaseSecurityManager.getInstance().isIdentityInSecurityGroup(editor, frentixSuperAdminGroup)) { + SecurityGroup frentixSuperAdminGroup = securityManager.findSecurityGroupByName("fxadmins"); + if(securityManager.isIdentityInSecurityGroup(identity, frentixSuperAdminGroup)){ + if(editor.equals(identity) || securityManager.isIdentityInSecurityGroup(editor, frentixSuperAdminGroup)) { return true; } return false; } - if (isOlatAdmin) return true; + if (isOlatAdmin) { + return true; + } // only admins can administrate admin and usermanager users boolean isAdmin = securityManager.isIdentityPermittedOnResourceable(identity, Constants.PERMISSION_HASROLE, Constants.ORESOURCE_ADMIN); boolean isUserManager = securityManager.isIdentityPermittedOnResourceable(identity, Constants.PERMISSION_HASROLE, Constants.ORESOURCE_USERMANAGER); - if (isAdmin || isUserManager) return false; + if (isAdmin || isUserManager) { + return false; + } // if user is author ony allowed to edit if configured boolean isAuthor = securityManager.isIdentityPermittedOnResourceable(identity, Constants.PERMISSION_HASROLE, Constants.ORESOURCE_AUTHOR); Boolean canManageAuthor = BaseSecurityModule.USERMANAGER_CAN_MANAGE_AUTHORS; - if (isAuthor && !canManageAuthor.booleanValue()) return false; + if (isAuthor && !canManageAuthor.booleanValue()) { + return false; + } // if user is groupmanager ony allowed to edit if configured boolean isGroupManager = securityManager.isIdentityPermittedOnResourceable(identity, Constants.PERMISSION_HASROLE, Constants.ORESOURCE_GROUPMANAGER); Boolean canManageGroupmanager = BaseSecurityModule.USERMANAGER_CAN_MANAGE_GROUPMANAGERS; - if (isGroupManager && !canManageGroupmanager.booleanValue()) return false; + if (isGroupManager && !canManageGroupmanager.booleanValue()) { + return false; + } // if user is guest ony allowed to edit if configured boolean isGuestOnly = securityManager.isIdentityPermittedOnResourceable(identity, Constants.PERMISSION_HASROLE, Constants.ORESOURCE_GUESTONLY); Boolean canManageGuest = BaseSecurityModule.USERMANAGER_CAN_MANAGE_GUESTS; - if (isGuestOnly && !canManageGuest.booleanValue()) return false; + if (isGuestOnly && !canManageGuest.booleanValue()) { + return false; + } // passed all tests, current user is allowed to edit given identity return true; } @@ -279,7 +294,7 @@ public class UserAdminController extends BasicController implements Activateable * profile form. The system admin is always able to do so. */ Boolean canEditAllFields = BaseSecurityModule.USERMANAGER_CAN_EDIT_ALL_PROFILE_FIELDS; - if (BaseSecurityManager.getInstance().isIdentityPermittedOnResourceable(identity, Constants.PERMISSION_HASROLE, Constants.ORESOURCE_ADMIN)) { + if (securityManager.isIdentityPermittedOnResourceable(identity, Constants.PERMISSION_HASROLE, Constants.ORESOURCE_ADMIN)) { canEditAllFields = Boolean.TRUE; } @@ -320,6 +335,7 @@ public class UserAdminController extends BasicController implements Activateable if (isOlatAdmin) { efficicencyCtrl = new CertificateAndEfficiencyStatementListController(ureq, getWindowControl(), identity, true); + listenTo(efficicencyCtrl); BreadcrumbedStackedPanel stackPanel = new BreadcrumbedStackedPanel("statements", getTranslator(), efficicencyCtrl); stackPanel.pushController(translate(NLS_VIEW_EFF_STATEMENTS), efficicencyCtrl); efficicencyCtrl.setBreadcrumbPanel(stackPanel); @@ -344,6 +360,16 @@ public class UserAdminController extends BasicController implements Activateable userTabP.addTab(translate(NLS_EDIT_UQUOTA), quotaCtr.getInitialComponent()); } + if(lectureModule.isEnabled()) { + lecturesCtrl = new ParticipantLecturesOverviewController(ureq, getWindowControl(), identity, true, true); + listenTo(lecturesCtrl); + BreadcrumbedStackedPanel stackPanel = new BreadcrumbedStackedPanel("lectures", getTranslator(), lecturesCtrl); + stackPanel.pushController(translate(NLS_VIEW_LECTURES), lecturesCtrl); + lecturesCtrl.setBreadcrumbPanel(stackPanel); + stackPanel.setInvisibleCrumb(1); + userTabP.addTab(translate(NLS_VIEW_LECTURES), stackPanel); + } + // now push to velocity myContent.put("userTabP", userTabP); } diff --git a/src/main/java/org/olat/admin/user/_i18n/LocalStrings_de.properties b/src/main/java/org/olat/admin/user/_i18n/LocalStrings_de.properties index 048375e4108e9fe20ecbb99e75bdf637137a324e..86047f2db7364e468abac4a500a79785787a1f7f 100644 --- a/src/main/java/org/olat/admin/user/_i18n/LocalStrings_de.properties +++ b/src/main/java/org/olat/admin/user/_i18n/LocalStrings_de.properties @@ -153,4 +153,5 @@ user.found=Benutzer wurde gefunden view.courses=Lernressourcen view.effStatements=Statements view.groups=Gruppen +view.lectures=Lektionen view.subscriptions=Abonnements diff --git a/src/main/java/org/olat/admin/user/_i18n/LocalStrings_en.properties b/src/main/java/org/olat/admin/user/_i18n/LocalStrings_en.properties index 93908db9cc2cd5611ef897eb7f59236c309b5974..2b9c5c6e304fda57346138db5368ef74eeae1698 100644 --- a/src/main/java/org/olat/admin/user/_i18n/LocalStrings_en.properties +++ b/src/main/java/org/olat/admin/user/_i18n/LocalStrings_en.properties @@ -153,4 +153,5 @@ user.found=User was found view.courses=Learning resources view.effStatements=Statements view.groups=Groups +view.lectures=Lectures view.subscriptions=Subscriptions diff --git a/src/main/java/org/olat/modules/lecture/manager/LectureBlockDAO.java b/src/main/java/org/olat/modules/lecture/manager/LectureBlockDAO.java index 8e93146f9e1e21c6621ee399525c9eabfd556892..d8ceb49a454bd8815269af153afd19762cb6a5ee 100644 --- a/src/main/java/org/olat/modules/lecture/manager/LectureBlockDAO.java +++ b/src/main/java/org/olat/modules/lecture/manager/LectureBlockDAO.java @@ -65,6 +65,7 @@ public class LectureBlockDAO { block.setLastModified(block.getCreationDate()); block.setStatus(LectureBlockStatus.active); block.setRollCallStatus(LectureRollCallStatus.open); + block.setCompulsory(true); block.setEntry(entry); return block; } diff --git a/src/main/java/org/olat/modules/lecture/ui/ParticipantLectureBlocksController.java b/src/main/java/org/olat/modules/lecture/ui/ParticipantLectureBlocksController.java index d22949a64a3d8c870e221417d76bd72016c899e2..85cfbb7f11db9f797e936ad5ee55d3d59026b7e0 100644 --- a/src/main/java/org/olat/modules/lecture/ui/ParticipantLectureBlocksController.java +++ b/src/main/java/org/olat/modules/lecture/ui/ParticipantLectureBlocksController.java @@ -102,9 +102,8 @@ public class ParticipantLectureBlocksController extends FormBasicController { @Autowired private RepositoryService repositoryService; - - public ParticipantLectureBlocksController(UserRequest ureq, WindowControl wControl, RepositoryEntry entry) { - this(ureq, wControl, entry, ureq.getIdentity(), true, true); + public ParticipantLectureBlocksController(UserRequest ureq, WindowControl wControl, RepositoryEntry entry, Identity assessedIdentity) { + this(ureq, wControl, entry, assessedIdentity, true, true); } private ParticipantLectureBlocksController(UserRequest ureq, WindowControl wControl, @@ -158,7 +157,7 @@ public class ParticipantLectureBlocksController extends FormBasicController { columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantCols.authorizedAbsentLectures)); } - if(appealEnabled && withAppeal) { + if(appealEnabled && withAppeal && assessedIdentity.equals(getIdentity())) { columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("appeal", ParticipantCols.appeal.ordinal(), "appeal", new BooleanCellRenderer(new StaticFlexiCellRenderer(translate("appeal"), "appeal"), null))); } diff --git a/src/main/java/org/olat/modules/lecture/ui/ParticipantLecturesOverviewController.java b/src/main/java/org/olat/modules/lecture/ui/ParticipantLecturesOverviewController.java index 4469a853bad7d38e86c8930b03e07a33b12361f4..599090c7d6c0de8b06dc50a83344d9bee7caf5eb 100644 --- a/src/main/java/org/olat/modules/lecture/ui/ParticipantLecturesOverviewController.java +++ b/src/main/java/org/olat/modules/lecture/ui/ParticipantLecturesOverviewController.java @@ -183,7 +183,7 @@ public class ParticipantLecturesOverviewController extends FormBasicController i removeAsListenerAndDispose(lectureBlocksCtrl); RepositoryEntry entry = repositoryService.loadByKey(statistics.getRepoKey()); - lectureBlocksCtrl = new ParticipantLectureBlocksController(ureq, getWindowControl(), entry); + lectureBlocksCtrl = new ParticipantLectureBlocksController(ureq, getWindowControl(), entry, assessedIdentity); listenTo(lectureBlocksCtrl); stackPanel.pushController(entry.getDisplayname(), lectureBlocksCtrl); }