Skip to content
Snippets Groups Projects
Commit cc63552d authored by aboeckle's avatar aboeckle
Browse files

OO-4678: Advanced rights for user relation role

parent 715637a2
No related branches found
No related tags found
No related merge requests found
Showing
with 220 additions and 90 deletions
...@@ -1350,7 +1350,15 @@ ...@@ -1350,7 +1350,15 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
</plugins> <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>10</source>
<target>10</target>
</configuration>
</plugin>
</plugins>
<pluginManagement> <pluginManagement>
<plugins> <plugins>
<!-- OLAT requires JDK 1.8 or later ! --> <!-- OLAT requires JDK 1.8 or later ! -->
......
...@@ -38,7 +38,7 @@ import org.olat.core.gui.control.controller.BasicController; ...@@ -38,7 +38,7 @@ import org.olat.core.gui.control.controller.BasicController;
import org.olat.core.id.Identity; import org.olat.core.id.Identity;
import org.olat.core.id.Roles; import org.olat.core.id.Roles;
import org.olat.core.id.UserConstants; import org.olat.core.id.UserConstants;
import org.olat.modules.coach.ui.UserRelationOverviewController; import org.olat.modules.coach.ui.UserOverviewController;
import org.olat.user.UserManager; import org.olat.user.UserManager;
import org.olat.user.propertyhandlers.UserPropertyHandler; import org.olat.user.propertyhandlers.UserPropertyHandler;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -79,7 +79,7 @@ public class UserShortDescription extends BasicController { ...@@ -79,7 +79,7 @@ public class UserShortDescription extends BasicController {
public UserShortDescription(UserRequest ureq, WindowControl wControl, Identity identity, boolean isAdministrativeUser) { public UserShortDescription(UserRequest ureq, WindowControl wControl, Identity identity, boolean isAdministrativeUser) {
super(ureq, wControl); super(ureq, wControl);
initProperties(UserRelationOverviewController.usageIdentifier, identity, isAdministrativeUser, true, null); initProperties(UserOverviewController.usageIdentifier, identity, isAdministrativeUser, true, null);
} }
private void initProperties(String identifier, Identity identity, boolean isAdministrativeUser, boolean usernameOnTop, Rows additionalRows) { private void initProperties(String identifier, Identity identity, boolean isAdministrativeUser, boolean usernameOnTop, Rows additionalRows) {
......
<div class="o_userShortDescription" id="$r.getCId()"> <div class="o_userShortDescription" id="$r.getCId()">
<table class="table table-bordered table-condensed table-striped"> <table class="table table-bordered table-condensed table-striped">
#if($r.isNotNull($usernamePosition) && $usernamePosition == "top") #if($r.isNotNull($identityKey) && $r.isNotNull($usernamePosition) && $usernamePosition == "top")
#if($r.isNotNull($username)) #if($r.isNotNull($username))
<tr class="o_prop o_username"> <tr class="o_prop o_username">
<th scope="row">$usernameLabel</th> <th scope="row">$usernameLabel</th>
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
</tr> </tr>
#end #end
#end #end
#if($r.isNotNull($usernamePosition) && $usernamePosition == "bottom") #if($r.isNotNull($identityKey) && $r.isNotNull($usernamePosition) && $usernamePosition == "bottom")
#if($r.isNotNull($username)) #if($r.isNotNull($username))
<tr class="o_prop o_username"> <tr class="o_prop o_username">
<th scope="row">$usernameLabel</th> <th scope="row">$usernameLabel</th>
......
...@@ -50,7 +50,9 @@ public interface IdentityRelationshipService { ...@@ -50,7 +50,9 @@ public interface IdentityRelationshipService {
public List<RelationRight> getAvailableRights(); public List<RelationRight> getAvailableRights();
public RelationRightProvider getRelationRightProvider(RelationRight right); public RightProvider getRelationRightProvider(RelationRight right);
public List<RightProvider> getAvailableRightProviders();
public boolean isInUse(RelationRole relationRole); public boolean isInUse(RelationRole relationRole);
......
...@@ -32,5 +32,4 @@ public interface RelationRight extends CreateInfo { ...@@ -32,5 +32,4 @@ public interface RelationRight extends CreateInfo {
public Long getKey(); public Long getKey();
public String getRight(); public String getRight();
} }
...@@ -20,7 +20,10 @@ ...@@ -20,7 +20,10 @@
package org.olat.basesecurity.manager; package org.olat.basesecurity.manager;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
...@@ -29,7 +32,7 @@ import org.olat.basesecurity.IdentityRelationshipService; ...@@ -29,7 +32,7 @@ import org.olat.basesecurity.IdentityRelationshipService;
import org.olat.basesecurity.IdentityToIdentityRelation; import org.olat.basesecurity.IdentityToIdentityRelation;
import org.olat.basesecurity.IdentityToIdentityRelationManagedFlag; import org.olat.basesecurity.IdentityToIdentityRelationManagedFlag;
import org.olat.basesecurity.RelationRight; import org.olat.basesecurity.RelationRight;
import org.olat.basesecurity.RelationRightProvider; import org.olat.basesecurity.RightProvider;
import org.olat.basesecurity.RelationRole; import org.olat.basesecurity.RelationRole;
import org.olat.basesecurity.RelationRoleManagedFlag; import org.olat.basesecurity.RelationRoleManagedFlag;
import org.olat.basesecurity.RelationSearchParams; import org.olat.basesecurity.RelationSearchParams;
...@@ -54,11 +57,11 @@ public class IdentityRelationshipServiceImpl implements IdentityRelationshipServ ...@@ -54,11 +57,11 @@ public class IdentityRelationshipServiceImpl implements IdentityRelationshipServ
private IdentityToIdentityRelationDAO identityRelationshipDao; private IdentityToIdentityRelationDAO identityRelationshipDao;
@Autowired @Autowired
private List<RelationRightProvider> relationRightProviders; private List<RightProvider> allRights;
@PostConstruct @PostConstruct
void ensureRightsExists() { void ensureRightsExists() {
for (RelationRightProvider relationRightProvider : relationRightProviders) { for (RightProvider relationRightProvider : allRights) {
relationRightDao.ensureRightExists(relationRightProvider.getRight()); relationRightDao.ensureRightExists(relationRightProvider.getRight());
} }
} }
...@@ -70,7 +73,7 @@ public class IdentityRelationshipServiceImpl implements IdentityRelationshipServ ...@@ -70,7 +73,7 @@ public class IdentityRelationshipServiceImpl implements IdentityRelationshipServ
@Override @Override
public RelationRole createRole(String role, List<RelationRight> rights) { public RelationRole createRole(String role, List<RelationRight> rights) {
RelationRole relationRole = relationRoleDao.createRelationRole(role, null, null, null); RelationRole relationRole = relationRoleDao.createRelationRole(role, null, null, null, true);
if(rights != null && !rights.isEmpty()) { if(rights != null && !rights.isEmpty()) {
relationRoleDao.setRights(relationRole, rights); relationRoleDao.setRights(relationRole, rights);
} }
...@@ -80,7 +83,7 @@ public class IdentityRelationshipServiceImpl implements IdentityRelationshipServ ...@@ -80,7 +83,7 @@ public class IdentityRelationshipServiceImpl implements IdentityRelationshipServ
@Override @Override
public RelationRole createRole(String role, String externalId, String externalRef, public RelationRole createRole(String role, String externalId, String externalRef,
RelationRoleManagedFlag[] managedFlags, List<RelationRight> rights) { RelationRoleManagedFlag[] managedFlags, List<RelationRight> rights) {
RelationRole relationRole = relationRoleDao.createRelationRole(role, externalId, externalRef, managedFlags); RelationRole relationRole = relationRoleDao.createRelationRole(role, externalId, externalRef, managedFlags, true);
if(rights != null && !rights.isEmpty()) { if(rights != null && !rights.isEmpty()) {
relationRoleDao.setRights(relationRole, rights); relationRoleDao.setRights(relationRole, rights);
} }
...@@ -112,12 +115,15 @@ public class IdentityRelationshipServiceImpl implements IdentityRelationshipServ ...@@ -112,12 +115,15 @@ public class IdentityRelationshipServiceImpl implements IdentityRelationshipServ
@Override @Override
public List<RelationRight> getAvailableRights() { public List<RelationRight> getAvailableRights() {
return relationRightDao.loadRelationRights(); List<RelationRight> relationRights = relationRightDao.loadRelationRights();
List<String> relationRightStrings = allRights.stream().filter(RightProvider::isUserRelationsRight).map(RightProvider::getRight).collect(Collectors.toList());
return relationRights.stream().filter(right -> relationRightStrings.contains(right.getRight())).collect(Collectors.toList());
} }
@Override @Override
public RelationRightProvider getRelationRightProvider(RelationRight right) { public RightProvider getRelationRightProvider(RelationRight right) {
for (RelationRightProvider provider : relationRightProviders) { for (RightProvider provider : allRights) {
if (provider.getRight().equals(right.getRight())) { if (provider.getRight().equals(right.getRight())) {
return provider; return provider;
} }
...@@ -125,6 +131,14 @@ public class IdentityRelationshipServiceImpl implements IdentityRelationshipServ ...@@ -125,6 +131,14 @@ public class IdentityRelationshipServiceImpl implements IdentityRelationshipServ
return null; return null;
} }
@Override
public List<RightProvider> getAvailableRightProviders() {
return getAvailableRights().stream().map(this::getRelationRightProvider)
.filter(Objects::nonNull)
.sorted(Comparator.comparing(RightProvider::getUserRelationsPosition))
.collect(Collectors.toList());
}
@Override @Override
public boolean isInUse(RelationRole relationRole) { public boolean isInUse(RelationRole relationRole) {
return identityRelationshipDao.isUsed(relationRole); return identityRelationshipDao.isUsed(relationRole);
......
...@@ -89,5 +89,4 @@ public class RelationRightDAO { ...@@ -89,5 +89,4 @@ public class RelationRightDAO {
dbInstance.commitAndCloseSession(); dbInstance.commitAndCloseSession();
} }
} }
...@@ -47,7 +47,7 @@ public class RelationRoleDAO { ...@@ -47,7 +47,7 @@ public class RelationRoleDAO {
@Autowired @Autowired
private DB dbInstance; private DB dbInstance;
public RelationRole createRelationRole(String role, String externalId, String externalRef, RelationRoleManagedFlag[] flags) { public RelationRole createRelationRole(String role, String externalId, String externalRef, RelationRoleManagedFlag[] flags, boolean userToUserRoleOnly) {
RelationRoleImpl relationRole = new RelationRoleImpl(); RelationRoleImpl relationRole = new RelationRoleImpl();
relationRole.setCreationDate(new Date()); relationRole.setCreationDate(new Date());
relationRole.setLastModified(relationRole.getCreationDate()); relationRole.setLastModified(relationRole.getCreationDate());
......
...@@ -19,9 +19,12 @@ ...@@ -19,9 +19,12 @@
*/ */
package org.olat.course.certificate; package org.olat.course.certificate;
import java.util.Collection;
import java.util.Collections;
import java.util.Locale; import java.util.Locale;
import org.olat.basesecurity.RelationRightProvider; import org.olat.basesecurity.OrganisationRoles;
import org.olat.basesecurity.RightProvider;
import org.olat.core.gui.translator.Translator; import org.olat.core.gui.translator.Translator;
import org.olat.core.util.Util; import org.olat.core.util.Util;
import org.olat.course.certificate.ui.CertificateController; import org.olat.course.certificate.ui.CertificateController;
...@@ -34,7 +37,7 @@ import org.springframework.stereotype.Component; ...@@ -34,7 +37,7 @@ import org.springframework.stereotype.Component;
* *
*/ */
@Component @Component
public class CertificateEmailRightProvider implements RelationRightProvider { public class CertificateEmailRightProvider implements RightProvider {
public static final String RELATION_RIGHT = "certificateEmail"; public static final String RELATION_RIGHT = "certificateEmail";
...@@ -44,13 +47,28 @@ public class CertificateEmailRightProvider implements RelationRightProvider { ...@@ -44,13 +47,28 @@ public class CertificateEmailRightProvider implements RelationRightProvider {
} }
@Override @Override
public RelationRightProvider getParent() { public RightProvider getParent() {
return null; return null;
} }
@Override @Override
public int getPosition() { public boolean isUserRelationsRight() {
return Order.CertificateEmailRight.ordinal(); return true;
}
@Override
public int getUserRelationsPosition() {
return UserRelationRightsOrder.CertificateEmailRight.ordinal();
}
@Override
public Collection<OrganisationRoles> getOrganisationRoles() {
return Collections.emptyList();
}
@Override
public int getOrganisationPosition() {
return -1;
} }
@Override @Override
......
...@@ -49,6 +49,7 @@ import org.olat.core.gui.control.Controller; ...@@ -49,6 +49,7 @@ import org.olat.core.gui.control.Controller;
import org.olat.core.gui.control.Event; import org.olat.core.gui.control.Event;
import org.olat.core.gui.control.WindowControl; import org.olat.core.gui.control.WindowControl;
import org.olat.core.gui.control.generic.closablewrapper.CloseableModalController; import org.olat.core.gui.control.generic.closablewrapper.CloseableModalController;
import org.olat.core.gui.control.generic.dtabs.Activateable2;
import org.olat.core.gui.control.generic.modal.DialogBoxController; import org.olat.core.gui.control.generic.modal.DialogBoxController;
import org.olat.core.gui.control.generic.modal.DialogBoxUIFactory; import org.olat.core.gui.control.generic.modal.DialogBoxUIFactory;
import org.olat.core.gui.render.Renderer; import org.olat.core.gui.render.Renderer;
...@@ -56,6 +57,8 @@ import org.olat.core.gui.render.StringOutput; ...@@ -56,6 +57,8 @@ import org.olat.core.gui.render.StringOutput;
import org.olat.core.gui.render.URLBuilder; import org.olat.core.gui.render.URLBuilder;
import org.olat.core.gui.translator.Translator; import org.olat.core.gui.translator.Translator;
import org.olat.core.id.Identity; import org.olat.core.id.Identity;
import org.olat.core.id.context.ContextEntry;
import org.olat.core.id.context.StateEntry;
import org.olat.core.util.StringHelper; import org.olat.core.util.StringHelper;
import org.olat.core.util.Util; import org.olat.core.util.Util;
import org.olat.core.util.coordinate.CoordinatorManager; import org.olat.core.util.coordinate.CoordinatorManager;
...@@ -87,14 +90,13 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -87,14 +90,13 @@ import org.springframework.beans.factory.annotation.Autowired;
* @author srosse, stephane.rosse@frentix.com, http://www.frentix.com * @author srosse, stephane.rosse@frentix.com, http://www.frentix.com
* *
*/ */
public class CertificateAndEfficiencyStatementListController extends FormBasicController public class CertificateAndEfficiencyStatementListController extends FormBasicController implements BreadcrumbPanelAware, GenericEventListener, Activateable2 {
implements BreadcrumbPanelAware, GenericEventListener {
private static final String CMD_SHOW = "cmd.show"; private static final String CMD_SHOW = "cmd.show";
private static final String CMD_LAUNCH_COURSE = "cmd.launch.course"; private static final String CMD_LAUNCH_COURSE = "cmd.launch.course";
private static final String CMD_DELETE = "cmd.delete"; private static final String CMD_DELETE = "cmd.delete";
private static final String CMD_MEDIA = "cmd.MEDIA"; private static final String CMD_MEDIA = "cmd.MEDIA";
private FlexiTableElement tableEl; private FlexiTableElement tableEl;
private BreadcrumbPanel stackPanel; private BreadcrumbPanel stackPanel;
private FormLink coachingToolButton; private FormLink coachingToolButton;
...@@ -128,27 +130,35 @@ public class CertificateAndEfficiencyStatementListController extends FormBasicCo ...@@ -128,27 +130,35 @@ public class CertificateAndEfficiencyStatementListController extends FormBasicCo
this(ureq, wControl, ureq.getUserSession().getIdentity(), false, true, true); this(ureq, wControl, ureq.getUserSession().getIdentity(), false, true, true);
} }
public CertificateAndEfficiencyStatementListController(UserRequest ureq, WindowControl wControl, public CertificateAndEfficiencyStatementListController(UserRequest ureq, WindowControl wControl, Identity assessedIdentity, boolean linkToCoachingTool, boolean canModify, boolean canLaunchCourse) {
Identity assessedIdentity, boolean linkToCoachingTool, boolean canModify, boolean canLaunchCourse) {
super(ureq, wControl, "cert_statement_list"); super(ureq, wControl, "cert_statement_list");
setTranslator(Util.createPackageTranslator(AssessmentModule.class, getLocale(), getTranslator())); setTranslator(Util.createPackageTranslator(AssessmentModule.class, getLocale(), getTranslator()));
this.canModify = canModify; this.canModify = canModify;
this.assessedIdentity = assessedIdentity; this.assessedIdentity = assessedIdentity;
this.linkToCoachingTool = linkToCoachingTool; this.linkToCoachingTool = linkToCoachingTool;
this.canLaunchCourse = canLaunchCourse; this.canLaunchCourse = canLaunchCourse;
// Show heading
flc.contextPut("showHeading", true);
initForm(ureq); initForm(ureq);
CoordinatorManager.getInstance().getCoordinator().getEventBus() CoordinatorManager.getInstance().getCoordinator().getEventBus()
.registerFor(this, getIdentity(), CertificatesManager.ORES_CERTIFICATE_EVENT); .registerFor(this, getIdentity(), CertificatesManager.ORES_CERTIFICATE_EVENT);
} }
public CertificateAndEfficiencyStatementListController(UserRequest ureq, WindowControl wControl, Identity assessedIdentity, boolean linkToCoachingTool, boolean canModify, boolean canLaunchCourse, boolean showHeading) {
this(ureq, wControl, assessedIdentity, linkToCoachingTool, canModify, canLaunchCourse);
// Set visibility of heading
flc.contextPut("showHeading", showHeading);
}
public CertificateAndEfficiencyStatementListController(UserRequest ureq, WindowControl wControl, public CertificateAndEfficiencyStatementListController(UserRequest ureq, WindowControl wControl, Identity assessedIdentity, boolean withFieldSet) {
Identity assessedIdentity, boolean useFieldSet) { this(ureq, wControl, assessedIdentity, false, false, true);
this(ureq, wControl, assessedIdentity, false, false, false);
// Show different header in user relations // Show different header in user management
flc.contextPut("withFieldSet", useFieldSet); flc.contextPut("withFieldSet", withFieldSet);
} }
@Override @Override
...@@ -226,6 +236,7 @@ public class CertificateAndEfficiencyStatementListController extends FormBasicCo ...@@ -226,6 +236,7 @@ public class CertificateAndEfficiencyStatementListController extends FormBasicCo
loadModel(); loadModel();
tableEl = uifactory.addTableElement(getWindowControl(), "certificates", tableModel, getTranslator(), formLayout); tableEl = uifactory.addTableElement(getWindowControl(), "certificates", tableModel, getTranslator(), formLayout);
tableEl.setElementCssClass("o_sel_certificates_table"); tableEl.setElementCssClass("o_sel_certificates_table");
tableEl.setEmtpyTableMessageKey("table.statements.empty");
} }
private void loadModel() { private void loadModel() {
...@@ -406,6 +417,11 @@ public class CertificateAndEfficiencyStatementListController extends FormBasicCo ...@@ -406,6 +417,11 @@ public class CertificateAndEfficiencyStatementListController extends FormBasicCo
cmc.activate(); cmc.activate();
} }
@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
}
public class AsArtefactCellRenderer implements FlexiCellRenderer { public class AsArtefactCellRenderer implements FlexiCellRenderer {
@Override @Override
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
</fieldset> </fieldset>
#else #else
## in users home ## in users home
<h2 ><i class="o_icon o_icon o_icon-fw o_icon_certificate"> </i>$r.translate("certificates.and.statements.title")</h2> #if($showHeading)
$r.render("certificates") <h2 ><i class="o_icon o_icon o_icon-fw o_icon_certificate"> </i>$r.translate("certificates.and.statements.title")</h2>
#end
$r.render("certificates")
#end #end
...@@ -19,6 +19,7 @@ completion=$org.olat.modules.assessment.ui\:learning.progress ...@@ -19,6 +19,7 @@ completion=$org.olat.modules.assessment.ui\:learning.progress
confirm.delete.title=Zertifikate l\u00F6schen confirm.delete.title=Zertifikate l\u00F6schen
confirm.delete.text=Wollen Sie dieses Zertifikat wirklich l\u00F6schen? confirm.delete.text=Wollen Sie dieses Zertifikat wirklich l\u00F6schen?
table.header.certificate=Zertifikat table.header.certificate=Zertifikat
table.statements.empty=Keine Leistungsnachweise oder Zertifikate vorhanden
choose.title=Vorlage ausw\u00E4hlen choose.title=Vorlage ausw\u00E4hlen
default.template=Standardvorlage default.template=Standardvorlage
details.certificate=Zertifikat details.certificate=Zertifikat
...@@ -73,4 +74,4 @@ confirm.certificate.deleted=Das Zertifikat vom {0} wurde gel\u00F6scht. ...@@ -73,4 +74,4 @@ confirm.certificate.deleted=Das Zertifikat vom {0} wurde gel\u00F6scht.
certificates.wizard.title=Zertifikate erstellen certificates.wizard.title=Zertifikate erstellen
certificates.wizard.select=Benutzer ausw\u00E4hlen certificates.wizard.select=Benutzer ausw\u00E4hlen
certificates.wizard.overview=\u00DCbersicht certificates.wizard.overview=\u00DCbersicht
msg.certificate.pending=Das Zertifikat wird in ein paar Sekunden erstellt. msg.certificate.pending=Das Zertifikat wird in ein paar Sekunden erstellt.
\ No newline at end of file
...@@ -64,6 +64,7 @@ recertification.week=Week ...@@ -64,6 +64,7 @@ recertification.week=Week
recertification.year=Year recertification.year=Year
replace=Replace replace=Replace
relation.right.email=Copy of certificates per E-Mail relation.right.email=Copy of certificates per E-Mail
table.statements.empty=No statements or certificates available
table.header.certificate=Certificate table.header.certificate=Certificate
template.file=File template.file=File
template.name=Name template.name=Name
......
...@@ -21,7 +21,7 @@ package org.olat.course.groupsandrights; ...@@ -21,7 +21,7 @@ package org.olat.course.groupsandrights;
import java.util.Locale; import java.util.Locale;
import org.olat.basesecurity.RelationRightProvider; import org.olat.basesecurity.RightProvider;
import org.olat.core.gui.translator.Translator; import org.olat.core.gui.translator.Translator;
import org.olat.core.util.Util; import org.olat.core.util.Util;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -33,23 +33,33 @@ import org.springframework.stereotype.Component; ...@@ -33,23 +33,33 @@ import org.springframework.stereotype.Component;
* *
*/ */
@Component @Component
public class ViewCourseCalendarRightProvider implements RelationRightProvider { public class ViewCourseCalendarRightProvider implements RightProvider {
public static final String RELATION_RIGHT = CourseRightsEnum.viewCourseCalendar.name(); public static final String RELATION_RIGHT = CourseRightsEnum.viewCourseCalendar.name();
@Override @Override
public RelationRightProvider getParent() { public String getRight() {
return RELATION_RIGHT;
}
@Override
public RightProvider getParent() {
return null; return null;
} }
@Override @Override
public int getPosition() { public boolean isUserRelationsRight() {
return Order.ViewCourseCalendarRight.ordinal(); return true;
} }
@Override @Override
public String getRight() { public int getUserRelationsPosition() {
return RELATION_RIGHT; return UserRelationRightsOrder.ViewCourseCalendarRight.ordinal();
}
@Override
public int getOrganisationPosition() {
return OrganisationRightsOrder.ViewCourseCalendarRight.ordinal();
} }
@Override @Override
......
...@@ -21,7 +21,7 @@ package org.olat.course.groupsandrights; ...@@ -21,7 +21,7 @@ package org.olat.course.groupsandrights;
import java.util.Locale; import java.util.Locale;
import org.olat.basesecurity.RelationRightProvider; import org.olat.basesecurity.RightProvider;
import org.olat.core.gui.translator.Translator; import org.olat.core.gui.translator.Translator;
import org.olat.core.util.Util; import org.olat.core.util.Util;
import org.olat.modules.coach.security.CoursesAndCurriculumRightProvider; import org.olat.modules.coach.security.CoursesAndCurriculumRightProvider;
...@@ -35,7 +35,7 @@ import org.springframework.stereotype.Component; ...@@ -35,7 +35,7 @@ import org.springframework.stereotype.Component;
* *
*/ */
@Component @Component
public class ViewEfficiencyStatementRightProvider implements RelationRightProvider { public class ViewEfficiencyStatementRightProvider implements RightProvider {
@Autowired @Autowired
private CoursesAndCurriculumRightProvider parentRight; private CoursesAndCurriculumRightProvider parentRight;
...@@ -43,18 +43,28 @@ public class ViewEfficiencyStatementRightProvider implements RelationRightProvid ...@@ -43,18 +43,28 @@ public class ViewEfficiencyStatementRightProvider implements RelationRightProvid
public static final String RELATION_RIGHT = CourseRightsEnum.viewEfficiencyStatement.name(); public static final String RELATION_RIGHT = CourseRightsEnum.viewEfficiencyStatement.name();
@Override @Override
public RelationRightProvider getParent() { public String getRight() {
return RELATION_RIGHT;
}
@Override
public RightProvider getParent() {
return parentRight; return parentRight;
} }
@Override @Override
public int getPosition() { public boolean isUserRelationsRight() {
return Order.ViewEfficiencyStatementRight.ordinal(); return true;
} }
@Override @Override
public String getRight() { public int getUserRelationsPosition() {
return RELATION_RIGHT; return UserRelationRightsOrder.ViewEfficiencyStatementRight.ordinal();
}
@Override
public int getOrganisationPosition() {
return OrganisationRightsOrder.ViewEfficiencyStatementRight.ordinal();
} }
@Override @Override
......
...@@ -21,7 +21,7 @@ package org.olat.modules.coach.security; ...@@ -21,7 +21,7 @@ package org.olat.modules.coach.security;
import java.util.Locale; import java.util.Locale;
import org.olat.basesecurity.RelationRightProvider; import org.olat.basesecurity.RightProvider;
import org.olat.core.gui.translator.Translator; import org.olat.core.gui.translator.Translator;
import org.olat.core.util.Util; import org.olat.core.util.Util;
import org.olat.modules.coach.ui.CoachMainController; import org.olat.modules.coach.ui.CoachMainController;
...@@ -32,23 +32,33 @@ import org.springframework.stereotype.Component; ...@@ -32,23 +32,33 @@ import org.springframework.stereotype.Component;
* @author aboeckle, alexander.boeckle@frentix.com * @author aboeckle, alexander.boeckle@frentix.com
*/ */
@Component @Component
public class AdministrativePropertiesRightProvider implements RelationRightProvider { public class AdministrativePropertiesRightProvider implements RightProvider {
public static final String RELATION_RIGHT = "showAdministrativeProperties"; public static final String RELATION_RIGHT = "showAdministrativeProperties";
@Override
public String getRight() {
return RELATION_RIGHT;
}
@Override @Override
public RelationRightProvider getParent() { public RightProvider getParent() {
return null; return null;
} }
@Override @Override
public int getPosition() { public boolean isUserRelationsRight() {
return Order.AdministrativePropertiesRight.ordinal(); return true;
} }
@Override @Override
public String getRight() { public int getUserRelationsPosition() {
return RELATION_RIGHT; return UserRelationRightsOrder.AdministrativePropertiesRight.ordinal();
}
@Override
public int getOrganisationPosition() {
return OrganisationRightsOrder.AdministrativePropertiesRight.ordinal();
} }
@Override @Override
......
...@@ -21,7 +21,7 @@ package org.olat.modules.coach.security; ...@@ -21,7 +21,7 @@ package org.olat.modules.coach.security;
import java.util.Locale; import java.util.Locale;
import org.olat.basesecurity.RelationRightProvider; import org.olat.basesecurity.RightProvider;
import org.olat.core.gui.translator.Translator; import org.olat.core.gui.translator.Translator;
import org.olat.core.util.Util; import org.olat.core.util.Util;
import org.olat.modules.coach.ui.CoachMainController; import org.olat.modules.coach.ui.CoachMainController;
...@@ -32,7 +32,7 @@ import org.springframework.stereotype.Component; ...@@ -32,7 +32,7 @@ import org.springframework.stereotype.Component;
* @author aboeckle, alexander.boeckle@frentix.com * @author aboeckle, alexander.boeckle@frentix.com
*/ */
@Component @Component
public class ContactFormRightProvider implements RelationRightProvider { public class ContactFormRightProvider implements RightProvider {
public static final String RELATION_RIGHT = "showContactform"; public static final String RELATION_RIGHT = "showContactform";
...@@ -42,13 +42,23 @@ public class ContactFormRightProvider implements RelationRightProvider { ...@@ -42,13 +42,23 @@ public class ContactFormRightProvider implements RelationRightProvider {
} }
@Override @Override
public RelationRightProvider getParent() { public RightProvider getParent() {
return null; return null;
} }
@Override @Override
public int getPosition() { public boolean isUserRelationsRight() {
return Order.ContactFormRight.ordinal(); return true;
}
@Override
public int getUserRelationsPosition() {
return UserRelationRightsOrder.ContactFormRight.ordinal();
}
@Override
public int getOrganisationPosition() {
return OrganisationRightsOrder.ContactFormRight.ordinal();
} }
@Override @Override
......
...@@ -21,7 +21,7 @@ package org.olat.modules.coach.security; ...@@ -21,7 +21,7 @@ package org.olat.modules.coach.security;
import java.util.Locale; import java.util.Locale;
import org.olat.basesecurity.RelationRightProvider; import org.olat.basesecurity.RightProvider;
import org.olat.core.gui.translator.Translator; import org.olat.core.gui.translator.Translator;
import org.olat.core.util.Util; import org.olat.core.util.Util;
import org.olat.modules.coach.ui.CoachMainController; import org.olat.modules.coach.ui.CoachMainController;
...@@ -33,26 +33,36 @@ import org.springframework.stereotype.Component; ...@@ -33,26 +33,36 @@ import org.springframework.stereotype.Component;
* @author aboeckle, alexander.boeckle@frentix.com * @author aboeckle, alexander.boeckle@frentix.com
*/ */
@Component @Component
public class CourseProgressAndStatusRightProvider implements RelationRightProvider { public class CourseProgressAndStatusRightProvider implements RightProvider {
@Autowired @Autowired
private CoursesAndCurriculumRightProvider parentRight; private CoursesAndCurriculumRightProvider parentRight;
public static final String RELATION_RIGHT = "showCourseProgressAndStatus"; public static final String RELATION_RIGHT = "showCourseProgressAndStatus";
@Override
public String getRight() {
return RELATION_RIGHT;
}
@Override @Override
public RelationRightProvider getParent() { public RightProvider getParent() {
return parentRight; return parentRight;
} }
@Override @Override
public int getPosition() { public boolean isUserRelationsRight() {
return Order.CourseProgressAndStatusRight.ordinal(); return true;
} }
@Override @Override
public String getRight() { public int getUserRelationsPosition() {
return RELATION_RIGHT; return UserRelationRightsOrder.CourseProgressAndStatusRight.ordinal();
}
@Override
public int getOrganisationPosition() {
return OrganisationRightsOrder.CourseProgressAndStatusRight.ordinal();
} }
@Override @Override
......
...@@ -21,7 +21,7 @@ package org.olat.modules.coach.security; ...@@ -21,7 +21,7 @@ package org.olat.modules.coach.security;
import java.util.Locale; import java.util.Locale;
import org.olat.basesecurity.RelationRightProvider; import org.olat.basesecurity.RightProvider;
import org.olat.core.gui.translator.Translator; import org.olat.core.gui.translator.Translator;
import org.olat.core.util.Util; import org.olat.core.util.Util;
import org.olat.modules.coach.ui.CoachMainController; import org.olat.modules.coach.ui.CoachMainController;
...@@ -32,23 +32,33 @@ import org.springframework.stereotype.Component; ...@@ -32,23 +32,33 @@ import org.springframework.stereotype.Component;
* @author aboeckle, alexander.boeckle@frentix.com * @author aboeckle, alexander.boeckle@frentix.com
*/ */
@Component @Component
public class CoursesAndCurriculumRightProvider implements RelationRightProvider{ public class CoursesAndCurriculumRightProvider implements RightProvider {
public static final String RELATION_RIGHT = "showCoursesAndCurriculum"; public static final String RELATION_RIGHT = "showCoursesAndCurriculum";
@Override
public String getRight() {
return RELATION_RIGHT;
}
@Override @Override
public RelationRightProvider getParent() { public RightProvider getParent() {
return null; return null;
} }
@Override @Override
public int getPosition() { public boolean isUserRelationsRight() {
return Order.CourseAndCurriculumRight.ordinal(); return true;
} }
@Override @Override
public String getRight() { public int getUserRelationsPosition() {
return RELATION_RIGHT; return UserRelationRightsOrder.CourseAndCurriculumRight.ordinal();
}
@Override
public int getOrganisationPosition() {
return OrganisationRightsOrder.CourseAndCurriculumRight.ordinal();
} }
@Override @Override
......
...@@ -21,7 +21,7 @@ package org.olat.modules.coach.security; ...@@ -21,7 +21,7 @@ package org.olat.modules.coach.security;
import java.util.Locale; import java.util.Locale;
import org.olat.basesecurity.RelationRightProvider; import org.olat.basesecurity.RightProvider;
import org.olat.core.gui.translator.Translator; import org.olat.core.gui.translator.Translator;
import org.olat.core.util.Util; import org.olat.core.util.Util;
import org.olat.modules.coach.ui.CoachMainController; import org.olat.modules.coach.ui.CoachMainController;
...@@ -33,26 +33,36 @@ import org.springframework.stereotype.Component; ...@@ -33,26 +33,36 @@ import org.springframework.stereotype.Component;
* @author aboeckle, alexander.boeckle@frentix.com * @author aboeckle, alexander.boeckle@frentix.com
*/ */
@Component @Component
public class LecturesAndAbsencesRightProvider implements RelationRightProvider { public class LecturesAndAbsencesRightProvider implements RightProvider {
@Autowired @Autowired
private CoursesAndCurriculumRightProvider parentRight; private CoursesAndCurriculumRightProvider parentRight;
public static final String RELATION_RIGHT = "showLecturesAndAbsences"; public static final String RELATION_RIGHT = "showLecturesAndAbsences";
@Override
public String getRight() {
return RELATION_RIGHT;
}
@Override @Override
public RelationRightProvider getParent() { public RightProvider getParent() {
return parentRight; return parentRight;
} }
@Override @Override
public int getPosition() { public boolean isUserRelationsRight() {
return Order.LecturesAndAbsencesRight.ordinal(); return true;
} }
@Override @Override
public String getRight() { public int getUserRelationsPosition() {
return RELATION_RIGHT; return UserRelationRightsOrder.LecturesAndAbsencesRight.ordinal();
}
@Override
public int getOrganisationPosition() {
return OrganisationRightsOrder.LecturesAndAbsencesRight.ordinal();
} }
@Override @Override
......
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