From be1ef6b24465778500d80d0cc6280c7e4ffa3849 Mon Sep 17 00:00:00 2001 From: anhefti Date: Mon, 8 Jul 2019 09:14:53 +0200 Subject: [PATCH] fixes for v0.3.1 --- findbugs-excludes.xml | 4 ++++ .../java/ch/ethz/seb/sebserver/gbl/api/API.java | 2 ++ .../seb/sebserver/gui/table/TableFilter.java | 10 +++++++--- .../authorization/AuthorizationService.java | 1 + .../servicelayer/authorization/UserService.java | 2 ++ .../{ => impl}/AuthorizationServiceImpl.java | 4 +++- .../authorization/{ => impl}/SEBServerUser.java | 2 +- .../{ => impl}/UserServiceImpl.java | 3 ++- .../servicelayer/dao/UserActivityLogDAO.java | 2 +- .../webservice/servicelayer/dao/UserDAO.java | 2 +- .../dao/impl/UserActivityLogDAOImpl.java | 2 +- .../servicelayer/dao/impl/UserDAOImpl.java | 2 +- .../api/ConfigurationNodeController.java | 2 +- .../api/ExamAdministrationController.java | 2 +- .../weblayer/api/ExamMonitiroingEndpoint.java | 17 +++++++++++++++++ .../weblayer/api/InstitutionController.java | 2 +- .../weblayer/api/UserAccountController.java | 2 +- src/main/resources/data-demo.sql | 4 ++++ .../authorization/AuthorizationServiceTest.java | 3 +++ 19 files changed, 54 insertions(+), 14 deletions(-) rename src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/{ => impl}/AuthorizationServiceImpl.java (96%) rename src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/{ => impl}/SEBServerUser.java (96%) rename src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/{ => impl}/UserServiceImpl.java (95%) create mode 100644 src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/ExamMonitiroingEndpoint.java diff --git a/findbugs-excludes.xml b/findbugs-excludes.xml index 95da4dcd..7586c635 100644 --- a/findbugs-excludes.xml +++ b/findbugs-excludes.xml @@ -15,6 +15,10 @@ + + + + diff --git a/src/main/java/ch/ethz/seb/sebserver/gbl/api/API.java b/src/main/java/ch/ethz/seb/sebserver/gbl/api/API.java index 690c284e..7d6eb0e3 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gbl/api/API.java +++ b/src/main/java/ch/ethz/seb/sebserver/gbl/api/API.java @@ -58,6 +58,8 @@ public final class API { public static final String EXAM_ADMINISTRATION_ENDPOINT = "/exam"; + public static final String EXAM_MONITORING_ENDPOINT = "/monitoring"; + public static final String EXAM_INDICATOR_ENDPOINT = "/indicator"; public static final String SEB_CLIENT_CONFIG_ENDPOINT = "/client_configuration"; diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/table/TableFilter.java b/src/main/java/ch/ethz/seb/sebserver/gui/table/TableFilter.java index c1dcc6c0..00fd82ef 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/table/TableFilter.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/table/TableFilter.java @@ -314,9 +314,13 @@ public class TableFilter { @Override FilterComponent reset() { - final org.joda.time.DateTime now = org.joda.time.DateTime.now(DateTimeZone.UTC); - - this.selector.setDate(now.getYear(), now.getMonthOfYear() - 1, now.getDayOfMonth()); + try { + final org.joda.time.DateTime parse = org.joda.time.DateTime.parse(this.attribute.initValue); + this.selector.setDate(parse.getYear(), parse.getMonthOfYear() - 1, parse.getDayOfMonth()); + } catch (final Exception e) { + final org.joda.time.DateTime now = org.joda.time.DateTime.now(DateTimeZone.UTC); + this.selector.setDate(now.getYear(), now.getMonthOfYear() - 1, now.getDayOfMonth()); + } return this; } diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/AuthorizationService.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/AuthorizationService.java index a97fc285..fdec0bff 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/AuthorizationService.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/AuthorizationService.java @@ -18,6 +18,7 @@ import ch.ethz.seb.sebserver.gbl.model.GrantEntity; import ch.ethz.seb.sebserver.gbl.model.user.UserInfo; import ch.ethz.seb.sebserver.gbl.model.user.UserRole; import ch.ethz.seb.sebserver.gbl.util.Result; +import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.impl.SEBServerUser; /** A service to check authorization grants for a given user for entity-types and -instances * diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/UserService.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/UserService.java index 31138fe6..9bf8a64f 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/UserService.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/UserService.java @@ -12,6 +12,8 @@ import java.security.Principal; import org.springframework.web.bind.WebDataBinder; +import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.impl.SEBServerUser; + /** A service to get the authenticated user from current request */ public interface UserService { diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/AuthorizationServiceImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/impl/AuthorizationServiceImpl.java similarity index 96% rename from src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/AuthorizationServiceImpl.java rename to src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/impl/AuthorizationServiceImpl.java index da9a9100..b1a22ac6 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/AuthorizationServiceImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/impl/AuthorizationServiceImpl.java @@ -6,7 +6,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -package ch.ethz.seb.sebserver.webservice.servicelayer.authorization; +package ch.ethz.seb.sebserver.webservice.servicelayer.authorization.impl; import java.util.Collection; import java.util.Collections; @@ -25,6 +25,8 @@ import ch.ethz.seb.sebserver.gbl.api.authorization.Privilege.RoleTypeKey; import ch.ethz.seb.sebserver.gbl.api.authorization.PrivilegeType; import ch.ethz.seb.sebserver.gbl.model.user.UserRole; import ch.ethz.seb.sebserver.gbl.profile.WebServiceProfile; +import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.AuthorizationService; +import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.UserService; @Lazy @Service diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/SEBServerUser.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/impl/SEBServerUser.java similarity index 96% rename from src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/SEBServerUser.java rename to src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/impl/SEBServerUser.java index 1a4016b6..7ccb58ae 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/SEBServerUser.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/impl/SEBServerUser.java @@ -6,7 +6,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -package ch.ethz.seb.sebserver.webservice.servicelayer.authorization; +package ch.ethz.seb.sebserver.webservice.servicelayer.authorization.impl; import java.util.Collection; import java.util.Collections; diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/UserServiceImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/impl/UserServiceImpl.java similarity index 95% rename from src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/UserServiceImpl.java rename to src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/impl/UserServiceImpl.java index bcabeb26..dcddcde2 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/UserServiceImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/impl/UserServiceImpl.java @@ -6,7 +6,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -package ch.ethz.seb.sebserver.webservice.servicelayer.authorization; +package ch.ethz.seb.sebserver.webservice.servicelayer.authorization.impl; import java.beans.PropertyEditorSupport; import java.security.Principal; @@ -28,6 +28,7 @@ import org.springframework.web.bind.WebDataBinder; import ch.ethz.seb.sebserver.gbl.model.user.UserInfo; import ch.ethz.seb.sebserver.gbl.model.user.UserRole; import ch.ethz.seb.sebserver.gbl.profile.WebServiceProfile; +import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.UserService; @Lazy @Service diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/UserActivityLogDAO.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/UserActivityLogDAO.java index 35998d6e..47ae1a43 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/UserActivityLogDAO.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/UserActivityLogDAO.java @@ -16,7 +16,7 @@ import ch.ethz.seb.sebserver.gbl.model.Entity; import ch.ethz.seb.sebserver.gbl.model.user.UserActivityLog; import ch.ethz.seb.sebserver.gbl.model.user.UserLogActivityType; import ch.ethz.seb.sebserver.gbl.util.Result; -import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.SEBServerUser; +import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.impl.SEBServerUser; /** Concrete EntityDAO interface of UserActivityLog entities */ public interface UserActivityLogDAO extends diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/UserDAO.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/UserDAO.java index cc7b45e9..7808ddcb 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/UserDAO.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/UserDAO.java @@ -14,7 +14,7 @@ import ch.ethz.seb.sebserver.gbl.model.EntityKey; import ch.ethz.seb.sebserver.gbl.model.user.UserInfo; import ch.ethz.seb.sebserver.gbl.model.user.UserMod; import ch.ethz.seb.sebserver.gbl.util.Result; -import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.SEBServerUser; +import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.impl.SEBServerUser; import ch.ethz.seb.sebserver.webservice.servicelayer.bulkaction.BulkActionSupportDAO; /** The Data Access Object for all User related data like get user data within UserInfo, diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/UserActivityLogDAOImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/UserActivityLogDAOImpl.java index ff903a06..febdbb94 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/UserActivityLogDAOImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/UserActivityLogDAOImpl.java @@ -39,8 +39,8 @@ import ch.ethz.seb.sebserver.webservice.datalayer.batis.mapper.UserActivityLogRe import ch.ethz.seb.sebserver.webservice.datalayer.batis.mapper.UserActivityLogRecordMapper; import ch.ethz.seb.sebserver.webservice.datalayer.batis.mapper.UserRecordDynamicSqlSupport; import ch.ethz.seb.sebserver.webservice.datalayer.batis.model.UserActivityLogRecord; -import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.SEBServerUser; import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.UserService; +import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.impl.SEBServerUser; import ch.ethz.seb.sebserver.webservice.servicelayer.dao.DAOLoggingSupport; import ch.ethz.seb.sebserver.webservice.servicelayer.dao.FilterMap; import ch.ethz.seb.sebserver.webservice.servicelayer.dao.TransactionHandler; diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/UserDAOImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/UserDAOImpl.java index 30830942..2ce750c8 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/UserDAOImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/UserDAOImpl.java @@ -54,7 +54,7 @@ import ch.ethz.seb.sebserver.webservice.datalayer.batis.mapper.UserRecordDynamic import ch.ethz.seb.sebserver.webservice.datalayer.batis.mapper.UserRecordMapper; import ch.ethz.seb.sebserver.webservice.datalayer.batis.model.RoleRecord; import ch.ethz.seb.sebserver.webservice.datalayer.batis.model.UserRecord; -import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.SEBServerUser; +import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.impl.SEBServerUser; import ch.ethz.seb.sebserver.webservice.servicelayer.bulkaction.BulkAction; import ch.ethz.seb.sebserver.webservice.servicelayer.dao.DAOLoggingSupport; import ch.ethz.seb.sebserver.webservice.servicelayer.dao.FilterMap; diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/ConfigurationNodeController.java b/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/ConfigurationNodeController.java index 53570297..df39df78 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/ConfigurationNodeController.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/ConfigurationNodeController.java @@ -28,8 +28,8 @@ import ch.ethz.seb.sebserver.gbl.profile.WebServiceProfile; import ch.ethz.seb.sebserver.webservice.datalayer.batis.mapper.ConfigurationNodeRecordDynamicSqlSupport; import ch.ethz.seb.sebserver.webservice.servicelayer.PaginationService; import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.AuthorizationService; -import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.SEBServerUser; import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.UserService; +import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.impl.SEBServerUser; import ch.ethz.seb.sebserver.webservice.servicelayer.bulkaction.BulkActionService; import ch.ethz.seb.sebserver.webservice.servicelayer.dao.ConfigurationDAO; import ch.ethz.seb.sebserver.webservice.servicelayer.dao.ConfigurationNodeDAO; diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/ExamAdministrationController.java b/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/ExamAdministrationController.java index d6f9a1c6..e2ca3e31 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/ExamAdministrationController.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/ExamAdministrationController.java @@ -42,8 +42,8 @@ import ch.ethz.seb.sebserver.gbl.util.Result; import ch.ethz.seb.sebserver.webservice.datalayer.batis.mapper.ExamRecordDynamicSqlSupport; import ch.ethz.seb.sebserver.webservice.servicelayer.PaginationService; import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.AuthorizationService; -import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.SEBServerUser; import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.UserService; +import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.impl.SEBServerUser; import ch.ethz.seb.sebserver.webservice.servicelayer.bulkaction.BulkActionService; import ch.ethz.seb.sebserver.webservice.servicelayer.dao.ExamDAO; import ch.ethz.seb.sebserver.webservice.servicelayer.dao.FilterMap; diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/ExamMonitiroingEndpoint.java b/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/ExamMonitiroingEndpoint.java new file mode 100644 index 00000000..3e06ee53 --- /dev/null +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/ExamMonitiroingEndpoint.java @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2019 ETH Zürich, Educational Development and Technology (LET) + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +package ch.ethz.seb.sebserver.webservice.weblayer.api; + +public class ExamMonitiroingEndpoint { + + public ExamMonitiroingEndpoint() { + // TODO Auto-generated constructor stub + } + +} diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/InstitutionController.java b/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/InstitutionController.java index 1b936e49..848eec1f 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/InstitutionController.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/InstitutionController.java @@ -20,7 +20,7 @@ import ch.ethz.seb.sebserver.gbl.profile.WebServiceProfile; import ch.ethz.seb.sebserver.webservice.datalayer.batis.mapper.InstitutionRecordDynamicSqlSupport; import ch.ethz.seb.sebserver.webservice.servicelayer.PaginationService; import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.AuthorizationService; -import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.SEBServerUser; +import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.impl.SEBServerUser; import ch.ethz.seb.sebserver.webservice.servicelayer.bulkaction.BulkActionService; import ch.ethz.seb.sebserver.webservice.servicelayer.dao.InstitutionDAO; import ch.ethz.seb.sebserver.webservice.servicelayer.dao.UserActivityLogDAO; diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/UserAccountController.java b/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/UserAccountController.java index b4542db3..bc96ec4b 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/UserAccountController.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/UserAccountController.java @@ -44,7 +44,7 @@ import ch.ethz.seb.sebserver.gbl.util.Result; import ch.ethz.seb.sebserver.webservice.datalayer.batis.mapper.UserRecordDynamicSqlSupport; import ch.ethz.seb.sebserver.webservice.servicelayer.PaginationService; import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.AuthorizationService; -import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.SEBServerUser; +import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.impl.SEBServerUser; import ch.ethz.seb.sebserver.webservice.servicelayer.bulkaction.BulkActionService; import ch.ethz.seb.sebserver.webservice.servicelayer.dao.UserActivityLogDAO; import ch.ethz.seb.sebserver.webservice.servicelayer.dao.UserDAO; diff --git a/src/main/resources/data-demo.sql b/src/main/resources/data-demo.sql index f9ef37d7..551cb956 100644 --- a/src/main/resources/data-demo.sql +++ b/src/main/resources/data-demo.sql @@ -12,6 +12,10 @@ INSERT IGNORE INTO user_role VALUES (3, 1, 'EXAM_ADMIN'), (4, 1, 'EXAM_SUPPORTER') ; + +INSERT IGNORE INTO seb_client_configuration VALUES + (1, 1, 'test', '2019-07-02 09:22:50', 'test', '98ac3c953abf5948d9d13c81cab580819ee2624c76d6d4147d4896a5b79f49956d382c08c93cb3b9ae350b32', null, 1) + ; INSERT IGNORE INTO view VALUES (1, 'general', 4, 1), diff --git a/src/test/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/AuthorizationServiceTest.java b/src/test/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/AuthorizationServiceTest.java index 85df2fc5..2b718ff3 100644 --- a/src/test/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/AuthorizationServiceTest.java +++ b/src/test/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/AuthorizationServiceTest.java @@ -26,6 +26,9 @@ import ch.ethz.seb.sebserver.gbl.api.authorization.PrivilegeType; import ch.ethz.seb.sebserver.gbl.model.GrantEntity; import ch.ethz.seb.sebserver.gbl.model.user.UserInfo; import ch.ethz.seb.sebserver.gbl.model.user.UserRole; +import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.impl.AuthorizationServiceImpl; +import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.impl.SEBServerUser; +import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.impl.UserServiceImpl; public class AuthorizationServiceTest {