fixed privilege check on SEB Client Events list and update quiz filter
This commit is contained in:
parent
a37ab31ff1
commit
e7af727854
7 changed files with 441 additions and 439 deletions
|
@ -34,7 +34,7 @@ public class GuiInit implements ApplicationListener<ApplicationReadyEvent> {
|
||||||
SEBServerInit.INIT_LOGGER.info("----> **** GUI Service starting up... ****");
|
SEBServerInit.INIT_LOGGER.info("----> **** GUI Service starting up... ****");
|
||||||
|
|
||||||
SEBServerInit.INIT_LOGGER.info("---->");
|
SEBServerInit.INIT_LOGGER.info("---->");
|
||||||
SEBServerInit.INIT_LOGGER.info("----> GUI Service sucessfully successfully started up!");
|
SEBServerInit.INIT_LOGGER.info("----> GUI Service successfully successfully started up!");
|
||||||
SEBServerInit.INIT_LOGGER.info("---->");
|
SEBServerInit.INIT_LOGGER.info("---->");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,12 +73,12 @@ public final class InstitutionalAuthenticationEntryPoint implements Authenticati
|
||||||
this.webserviceURIService = webserviceURIService;
|
this.webserviceURIService = webserviceURIService;
|
||||||
this.clientHttpRequestFactoryService = clientHttpRequestFactoryService;
|
this.clientHttpRequestFactoryService = clientHttpRequestFactoryService;
|
||||||
|
|
||||||
String _defaultLogo = null;
|
String _defaultLogo;
|
||||||
if (!Constants.NO_NAME.equals(defaultLogoFileName)) {
|
if (!Constants.NO_NAME.equals(defaultLogoFileName)) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
final String extension = ImageUploadSelection.SUPPORTED_IMAGE_FILES.stream()
|
final String extension = ImageUploadSelection.SUPPORTED_IMAGE_FILES.stream()
|
||||||
.filter(ext -> defaultLogoFileName.endsWith(ext))
|
.filter(defaultLogoFileName::endsWith)
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ public final class InstitutionalAuthenticationEntryPoint implements Authenticati
|
||||||
: null);
|
: null);
|
||||||
|
|
||||||
if (log.isDebugEnabled()) {
|
if (log.isDebugEnabled()) {
|
||||||
log.debug("Known and active gui entrypoint requested:", institutions);
|
log.debug("Known and active gui entrypoint requested: {}", institutions);
|
||||||
}
|
}
|
||||||
|
|
||||||
final String logoImageBase64 = requestLogoImage(institutionalEndpoint);
|
final String logoImageBase64 = requestLogoImage(institutionalEndpoint);
|
||||||
|
@ -184,9 +184,7 @@ public final class InstitutionalAuthenticationEntryPoint implements Authenticati
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return requestURI.substring(
|
return requestURI.substring(requestURI.lastIndexOf(Constants.SLASH) + 1);
|
||||||
requestURI.lastIndexOf(Constants.SLASH) + 1,
|
|
||||||
requestURI.length());
|
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
log.error("Failed to extract institutional URL suffix: {}", e.getMessage());
|
log.error("Failed to extract institutional URL suffix: {}", e.getMessage());
|
||||||
return null;
|
return null;
|
||||||
|
@ -231,12 +229,12 @@ public final class InstitutionalAuthenticationEntryPoint implements Authenticati
|
||||||
if (exchange.getStatusCodeValue() == HttpStatus.OK.value()) {
|
if (exchange.getStatusCodeValue() == HttpStatus.OK.value()) {
|
||||||
return exchange.getBody();
|
return exchange.getBody();
|
||||||
} else {
|
} else {
|
||||||
log.warn("Failed to verify insitution from requested entrypoint url: {}, response: {}",
|
log.warn("Failed to verify institution from requested entrypoint url: {}, response: {}",
|
||||||
institutionalEndpoint,
|
institutionalEndpoint,
|
||||||
exchange);
|
exchange);
|
||||||
}
|
}
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
log.warn("Failed to verify insitution from requested entrypoint url: {}",
|
log.warn("Failed to verify institution from requested entrypoint url: {}",
|
||||||
institutionalEndpoint,
|
institutionalEndpoint,
|
||||||
e);
|
e);
|
||||||
}
|
}
|
||||||
|
@ -245,7 +243,7 @@ public final class InstitutionalAuthenticationEntryPoint implements Authenticati
|
||||||
}
|
}
|
||||||
|
|
||||||
/** TODO this seems not to work as expected. Different Theme is only possible in RAP on different
|
/** TODO this seems not to work as expected. Different Theme is only possible in RAP on different
|
||||||
* entry-points and since entry-points are statically defined within the RAPConficuration
|
* entry-points and since entry-points are statically defined within the RAPConfiguration
|
||||||
* there is no possibility to apply them dynamically within an institution so far.
|
* there is no possibility to apply them dynamically within an institution so far.
|
||||||
*
|
*
|
||||||
* @param institutionalEndpoint
|
* @param institutionalEndpoint
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class RAPConfiguration implements ApplicationConfiguration {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static interface EntryPointService {
|
public interface EntryPointService {
|
||||||
|
|
||||||
void loadLoginPage(final Composite parent);
|
void loadLoginPage(final Composite parent);
|
||||||
|
|
||||||
|
@ -160,5 +160,5 @@ public class RAPConfiguration implements ApplicationConfiguration {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,10 +8,7 @@
|
||||||
|
|
||||||
package ch.ethz.seb.sebserver.gui;
|
package ch.ethz.seb.sebserver.gui;
|
||||||
|
|
||||||
import javax.servlet.ServletContext;
|
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
||||||
import javax.servlet.ServletContextListener;
|
|
||||||
import javax.servlet.ServletException;
|
|
||||||
|
|
||||||
import org.eclipse.rap.rwt.engine.RWTServlet;
|
import org.eclipse.rap.rwt.engine.RWTServlet;
|
||||||
import org.eclipse.rap.rwt.engine.RWTServletContextListener;
|
import org.eclipse.rap.rwt.engine.RWTServletContextListener;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -25,7 +22,8 @@ import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
|
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
|
||||||
|
|
||||||
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
import javax.servlet.ServletContext;
|
||||||
|
import javax.servlet.ServletContextListener;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@GuiProfile
|
@GuiProfile
|
||||||
|
@ -73,7 +71,7 @@ public class RAPSpringConfig {
|
||||||
|
|
||||||
private static class RAPServletContextInitializer implements ServletContextInitializer {
|
private static class RAPServletContextInitializer implements ServletContextInitializer {
|
||||||
@Override
|
@Override
|
||||||
public void onStartup(final ServletContext servletContext) throws ServletException {
|
public void onStartup(final ServletContext servletContext) {
|
||||||
servletContext.setInitParameter(
|
servletContext.setInitParameter(
|
||||||
"org.eclipse.rap.applicationConfiguration",
|
"org.eclipse.rap.applicationConfiguration",
|
||||||
RAPConfiguration.class.getName());
|
RAPConfiguration.class.getName());
|
||||||
|
|
|
@ -123,7 +123,7 @@ public class WidgetFactory {
|
||||||
private ImageData image = null;
|
private ImageData image = null;
|
||||||
private ImageData greyedImage = null;
|
private ImageData greyedImage = null;
|
||||||
|
|
||||||
private ImageIcon(final String fileName) {
|
ImageIcon(final String fileName) {
|
||||||
this.fileName = fileName;
|
this.fileName = fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,7 +199,7 @@ public class WidgetFactory {
|
||||||
|
|
||||||
public final String key;
|
public final String key;
|
||||||
|
|
||||||
private CustomVariant(final String key) {
|
CustomVariant(final String key) {
|
||||||
this.key = key;
|
this.key = key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -268,7 +268,7 @@ public class WidgetFactory {
|
||||||
* @param parent The parent Composite
|
* @param parent The parent Composite
|
||||||
* @return the scrolled Composite to add the form content */
|
* @return the scrolled Composite to add the form content */
|
||||||
public Composite createPopupScrollComposite(final Composite parent) {
|
public Composite createPopupScrollComposite(final Composite parent) {
|
||||||
final Composite grid = PageService.createManagedVScrolledComposite(
|
return PageService.createManagedVScrolledComposite(
|
||||||
parent,
|
parent,
|
||||||
scrolledComposite -> {
|
scrolledComposite -> {
|
||||||
final Composite g = new Composite(scrolledComposite, SWT.NONE);
|
final Composite g = new Composite(scrolledComposite, SWT.NONE);
|
||||||
|
@ -277,7 +277,6 @@ public class WidgetFactory {
|
||||||
return g;
|
return g;
|
||||||
},
|
},
|
||||||
false);
|
false);
|
||||||
return grid;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Composite createWarningPanel(final Composite parent) {
|
public Composite createWarningPanel(final Composite parent) {
|
||||||
|
@ -733,7 +732,7 @@ public class WidgetFactory {
|
||||||
new FileUploadSelection(parent, this.i18nSupport, readonly);
|
new FileUploadSelection(parent, this.i18nSupport, readonly);
|
||||||
|
|
||||||
if (supportedFiles != null) {
|
if (supportedFiles != null) {
|
||||||
supportedFiles.forEach(ext -> fileUploadSelection.withSupportFor(ext));
|
supportedFiles.forEach(fileUploadSelection::withSupportFor);
|
||||||
}
|
}
|
||||||
return fileUploadSelection;
|
return fileUploadSelection;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ import ch.ethz.seb.sebserver.gbl.model.institution.LmsSetup;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.institution.LmsSetupTestResult;
|
import ch.ethz.seb.sebserver.gbl.model.institution.LmsSetupTestResult;
|
||||||
import ch.ethz.seb.sebserver.gbl.util.Result;
|
import ch.ethz.seb.sebserver.gbl.util.Result;
|
||||||
import ch.ethz.seb.sebserver.webservice.servicelayer.dao.FilterMap;
|
import ch.ethz.seb.sebserver.webservice.servicelayer.dao.FilterMap;
|
||||||
|
import org.joda.time.DateTimeZone;
|
||||||
|
|
||||||
/** Defines the LMS API access service interface with all functionality needed to access
|
/** Defines the LMS API access service interface with all functionality needed to access
|
||||||
* a LMS API within a given LmsSetup configuration.
|
* a LMS API within a given LmsSetup configuration.
|
||||||
|
@ -101,12 +102,12 @@ public interface LmsAPIService {
|
||||||
static Predicate<QuizData> quizFilterPredicate(final FilterMap filterMap) {
|
static Predicate<QuizData> quizFilterPredicate(final FilterMap filterMap) {
|
||||||
final String name = filterMap.getQuizName();
|
final String name = filterMap.getQuizName();
|
||||||
final DateTime from = filterMap.getQuizFromTime();
|
final DateTime from = filterMap.getQuizFromTime();
|
||||||
//final DateTime now = DateTime.now(DateTimeZone.UTC);
|
|
||||||
return q -> {
|
return q -> {
|
||||||
final boolean nameFilter = StringUtils.isBlank(name) || (q.name != null && q.name.contains(name));
|
final boolean nameFilter = StringUtils.isBlank(name) || (q.name != null && q.name.contains(name));
|
||||||
final boolean startTimeFilter =
|
final boolean startTimeFilter =
|
||||||
(from == null) || (q.startTime != null && (q.startTime.isEqual(from) || q.startTime.isAfter(from)));
|
(from == null) || (q.startTime != null && (q.startTime.isEqual(from) || q.startTime.isAfter(from)));
|
||||||
return nameFilter && startTimeFilter /* && endTimeFilter */;
|
final boolean currentlyRunning = DateTime.now(DateTimeZone.UTC).isBefore(q.endTime);
|
||||||
|
return nameFilter && (startTimeFilter || currentlyRunning) ;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,6 +95,8 @@ public class ClientEventController extends ReadonlyEntityController<ClientEvent,
|
||||||
filterMap.putIfAbsent(API.PARAM_INSTITUTION_ID, String.valueOf(institutionId));
|
filterMap.putIfAbsent(API.PARAM_INSTITUTION_ID, String.valueOf(institutionId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
return this.paginationService.getPage(
|
return this.paginationService.getPage(
|
||||||
pageNumber,
|
pageNumber,
|
||||||
pageSize,
|
pageSize,
|
||||||
|
@ -102,6 +104,10 @@ public class ClientEventController extends ReadonlyEntityController<ClientEvent,
|
||||||
getSQLTableOfEntity().name(),
|
getSQLTableOfEntity().name(),
|
||||||
() -> this.clientEventDAO.allMatchingExtended(filterMap, this::hasReadAccess))
|
() -> this.clientEventDAO.allMatchingExtended(filterMap, this::hasReadAccess))
|
||||||
.getOrThrow();
|
.getOrThrow();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -118,7 +124,7 @@ public class ClientEventController extends ReadonlyEntityController<ClientEvent,
|
||||||
protected GrantEntity toGrantEntity(final ClientEvent entity) {
|
protected GrantEntity toGrantEntity(final ClientEvent entity) {
|
||||||
return this.examDAO
|
return this.examDAO
|
||||||
.byClientConnection(entity.connectionId)
|
.byClientConnection(entity.connectionId)
|
||||||
.getOrThrow();
|
.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue