diff --git a/common/source/java/ch/systemsx/cisd/common/servlet/HeaderFilter.java b/common/source/java/ch/systemsx/cisd/common/servlet/HeaderFilter.java new file mode 100644 index 0000000000000000000000000000000000000000..acee6810f3d4b3a1700afe9bbc70b73fce7ed2e3 --- /dev/null +++ b/common/source/java/ch/systemsx/cisd/common/servlet/HeaderFilter.java @@ -0,0 +1,73 @@ +/* + * Copyright 2018 ETH Zuerich, SIS + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.common.servlet; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Enumeration; +import java.util.List; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.util.StringUtils; + +/** + * @author Franz-Josef Elmer + * + */ +public class HeaderFilter implements Filter +{ + private List<String> headerNames; + private List<String> headerValues; + + @Override + public void init(FilterConfig config) throws ServletException + { + Enumeration<String> initParameterNames = config.getInitParameterNames(); + headerNames = Arrays.asList(StringUtils.toStringArray(initParameterNames)); + headerValues = new ArrayList<>(headerNames.size()); + for (String name : headerNames) + { + headerValues.add(config.getInitParameter(name)); + } + } + + @Override + public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException + { + HttpServletResponse httpResponse = (HttpServletResponse) response; + + for (int i = 0; i < headerNames.size(); i++) + { + httpResponse.addHeader(headerNames.get(i), headerValues.get(i)); + } + filterChain.doFilter(request, response); + } + + @Override + public void destroy() + { + } + +} diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/DataStoreServer.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/DataStoreServer.java index a227191d4ae0d36aad2c7f5050d0e176a14e0326..f9ca5aa9dd93b8705ca01aa7bb4c731a9ef75b23 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/DataStoreServer.java +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/DataStoreServer.java @@ -249,6 +249,7 @@ public class DataStoreServer servletContextHandler.setAttribute( WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, ServiceProvider.getApplicationContext()); + servletContextHandler.getSessionHandler().getSessionCookieConfig().setHttpOnly(true); // Disable URL rewriting (forces container to stop appending ";jsessionid=xxx" to urls) // to avoid mistakes in URL parsing by download servlets servletContextHandler.getSessionHandler() diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/plugins/demo/DemoProcessingPlugin.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/plugins/demo/DemoProcessingPlugin.java index 8a7ae2ec5744a651c2dc12b8a1ce26a60af54a2f..d43929f9d3f6e3150aed72b3091cb0f6a85be83b 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/plugins/demo/DemoProcessingPlugin.java +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/plugins/demo/DemoProcessingPlugin.java @@ -57,12 +57,15 @@ public class DemoProcessingPlugin implements IProcessingPluginTask DataSetProcessingContext context) { operationLog.info("Processing of the following datasets has been requested: " + datasets); - Map<String, String> parameterBindings = context.getParameterBindings(); - if (parameterBindings.isEmpty() == false) + if (context != null) { - for (Entry<String, String> entry : parameterBindings.entrySet()) + Map<String, String> parameterBindings = context.getParameterBindings(); + if (parameterBindings != null && parameterBindings.isEmpty() == false) { - operationLog.info("Parameter: " + entry); + for (Entry<String, String> entry : parameterBindings.entrySet()) + { + operationLog.info("Parameter: " + entry); + } } } IHierarchicalContentProvider contentProvider = diff --git a/datastore_server/sourceTest/java/ch/ethz/sis/openbis/generic/dss/systemtest/api/v3/AggregationServiceTest.java b/datastore_server/sourceTest/java/ch/ethz/sis/openbis/generic/dss/systemtest/api/v3/AggregationServiceTest.java index c5faed5680534d6d0ab7628f63b426d4ffb33343..95f003d5c57bef0d4468c278dda5a38ed30e5176 100644 --- a/datastore_server/sourceTest/java/ch/ethz/sis/openbis/generic/dss/systemtest/api/v3/AggregationServiceTest.java +++ b/datastore_server/sourceTest/java/ch/ethz/sis/openbis/generic/dss/systemtest/api/v3/AggregationServiceTest.java @@ -226,6 +226,28 @@ public class AggregationServiceTest extends AbstractFileTest "Cannot find the data store UNKNOWN"); as.logout(sessionToken); } + + @Test + public void testExecuteAggregationServiceOfUnspecifiedDataStore() throws Exception + { + // Given + String sessionToken = as.login(TEST_USER, PASSWORD); + DssServicePermId id = new DssServicePermId("example-jython-aggregation-service-report"); + AggregationServiceExecutionOptions options = new AggregationServiceExecutionOptions(); + + assertUserFailureException(new IDelegatedAction() + { + @Override + public void execute() + { + // When + as.executeAggregationService(sessionToken, id, options); + } + }, + // Then + "Data store id cannot be null."); + as.logout(sessionToken); + } @Test public void testExecuteAggregationServiceWithMissingServiceId() diff --git a/datastore_server/sourceTest/java/ch/ethz/sis/openbis/generic/dss/systemtest/api/v3/ProcessingServiceTest.java b/datastore_server/sourceTest/java/ch/ethz/sis/openbis/generic/dss/systemtest/api/v3/ProcessingServiceTest.java index 3871f0508c363357aae05c47774b3bcac99de182..bc16fd21b805903b1162fb4eb692cda8c91b46cb 100644 --- a/datastore_server/sourceTest/java/ch/ethz/sis/openbis/generic/dss/systemtest/api/v3/ProcessingServiceTest.java +++ b/datastore_server/sourceTest/java/ch/ethz/sis/openbis/generic/dss/systemtest/api/v3/ProcessingServiceTest.java @@ -139,7 +139,7 @@ public class ProcessingServiceTest extends AbstractFileTest } @Test - public void testExecuteProcessingService() throws Exception + public void testExecuteProcessingServiceWithSpecifiedDataStore() throws Exception { // Given String dataSetCode = registerDataSet(); @@ -200,6 +200,68 @@ public class ProcessingServiceTest extends AbstractFileTest as.logout(sessionToken); } + @Test + public void testExecuteProcessingService() throws Exception + { + // Given + String dataSetCode = registerDataSet(); + String sessionToken = as.login(TEST_USER, PASSWORD); + DssServicePermId id = new DssServicePermId("demo-processor"); + ProcessingServiceExecutionOptions options = new ProcessingServiceExecutionOptions(); + options.withDataSets(dataSetCode).withParameter("greetings", "hello world"); + + // When + as.executeProcessingService(sessionToken, id, options); + + // Then + List<String> log = new ArrayList<>(); + waitUntil(new ILogMonitoringStopCondition() + { + @Override + public boolean stopConditionFulfilled(ParsedLogEntry logEntry) + { + String logMessage = logEntry.getLogMessage(); + if (logMessage.contains("DemoProcessingPlugin")) + { + log.add(logMessage.replace(dataSetCode, "<data set code>")); + } + return logMessage.contains("Processing done."); + } + }, 10); + Collections.sort(log); + assertEquals("OPERATION.DemoProcessingPlugin - Parameter: greetings=hello world\n" + + "OPERATION.DemoProcessingPlugin - Parameter: user=test\n" + + "OPERATION.DemoProcessingPlugin - Processing <data set code>/\n" + + "OPERATION.DemoProcessingPlugin - Processing <data set code>/original\n" + + "OPERATION.DemoProcessingPlugin - Processing <data set code>/original/<data set code>\n" + + "OPERATION.DemoProcessingPlugin - Processing <data set code>/original/<data set code>/file1.txt\n" + + "OPERATION.DemoProcessingPlugin - Processing <data set code>/original/<data set code>/file2.txt\n" + + "OPERATION.DemoProcessingPlugin - Processing <data set code>/original/<data set code>/subdir1\n" + + "OPERATION.DemoProcessingPlugin - Processing <data set code>/original/<data set code>/subdir1/file3.txt\n" + + "OPERATION.DemoProcessingPlugin - Processing <data set code>/original/<data set code>/subdir1/file4.txt\n" + + "OPERATION.DemoProcessingPlugin - Processing <data set code>/original/<data set code>/subdir1/subdir2\n" + + "OPERATION.DemoProcessingPlugin - Processing <data set code>/original/<data set code>/subdir1/subdir2/file5.txt\n" + + "OPERATION.DemoProcessingPlugin - Processing <data set code>/original/<data set code>/subdir3\n" + + "OPERATION.DemoProcessingPlugin - Processing <data set code>/original/<data set code>/subdir3/file6.txt\n" + + "OPERATION.DemoProcessingPlugin - Processing done.\n" + + "OPERATION.DemoProcessingPlugin - Processing of the following datasets has been requested: [Dataset '<data set code>']", + String.join("\n", log)); + File[] emails = EMAIL_FOLDER.listFiles(); + if (emails == null) + { + fail("Empty e-mails folder: " + EMAIL_FOLDER.getAbsolutePath()); + } + File emailFile = Collections.max(new ArrayList<>(Arrays.asList(emails))); + String email = FileUtilities.loadToString(emailFile); + assertContains("'Demo Processing' [demo-processor] processing finished on 1 data set(s):", email); + assertContains(dataSetCode, email); + PersonPermId personPermId = new PersonPermId(TEST_USER); + PersonFetchOptions fetchOptions = new PersonFetchOptions(); + String emailAddress = as.getPersons(sessionToken, Arrays.asList(personPermId), fetchOptions).get(personPermId).getEmail(); + assertContains("To: " + emailAddress, email); + as.logout(sessionToken); + } + @Test public void testExecuteProcessingServiceUsingReservedParameter() throws Exception { @@ -365,6 +427,7 @@ public class ProcessingServiceTest extends AbstractFileTest // Given String sessionToken = as.login(TEST_USER, PASSWORD); ProcessingServiceExecutionOptions options = new ProcessingServiceExecutionOptions(); + options.withDataSets("123"); assertUserFailureException(new IDelegatedAction() { @@ -387,6 +450,7 @@ public class ProcessingServiceTest extends AbstractFileTest String sessionToken = as.login(TEST_USER, PASSWORD); IDssServiceId id = new MyId(); ProcessingServiceExecutionOptions options = new ProcessingServiceExecutionOptions(); + options.withDataSets("123"); assertUserFailureException(new IDelegatedAction() { @@ -410,6 +474,7 @@ public class ProcessingServiceTest extends AbstractFileTest String sessionToken = as.login(TEST_USER, PASSWORD); IDssServiceId id = new DssServicePermId("", new DataStorePermId("STANDARD")); ProcessingServiceExecutionOptions options = new ProcessingServiceExecutionOptions(); + options.withDataSets("123"); assertUserFailureException(new IDelegatedAction() { @@ -433,6 +498,7 @@ public class ProcessingServiceTest extends AbstractFileTest String sessionToken = as.login(TEST_USER, PASSWORD); IDssServiceId id = new DssServicePermId("key", new MyId()); ProcessingServiceExecutionOptions options = new ProcessingServiceExecutionOptions(); + options.withDataSets("123"); assertUserFailureException(new IDelegatedAction() { @@ -456,6 +522,7 @@ public class ProcessingServiceTest extends AbstractFileTest String sessionToken = as.login(TEST_USER, PASSWORD); IDssServiceId id = new DssServicePermId("key", new DataStorePermId("")); ProcessingServiceExecutionOptions options = new ProcessingServiceExecutionOptions(); + options.withDataSets("123"); assertUserFailureException(new IDelegatedAction() { diff --git a/datastore_server/sourceTest/java/ch/ethz/sis/openbis/generic/dss/systemtest/api/v3/ReportingServiceTest.java b/datastore_server/sourceTest/java/ch/ethz/sis/openbis/generic/dss/systemtest/api/v3/ReportingServiceTest.java index 624c038e39e42b1251379846c234af8180a1ee4a..3e1930a9f471044a9a65551aaae362d2e95c7eda 100644 --- a/datastore_server/sourceTest/java/ch/ethz/sis/openbis/generic/dss/systemtest/api/v3/ReportingServiceTest.java +++ b/datastore_server/sourceTest/java/ch/ethz/sis/openbis/generic/dss/systemtest/api/v3/ReportingServiceTest.java @@ -110,6 +110,7 @@ public class ReportingServiceTest extends AbstractFileTest List<String> allDataSetTypeCodes = as.searchDataSetTypes(sessionToken, new DataSetTypeSearchCriteria(), new DataSetTypeFetchOptions()).getObjects().stream().map(t -> t.getCode()).collect(Collectors.toList()); Collections.sort(allDataSetTypeCodes); + System.err.println(allDataSetTypeCodes); // When List<ReportingService> services = as.searchReportingServices(sessionToken, searchCriteria, fetchOptions).getObjects(); @@ -131,7 +132,7 @@ public class ReportingServiceTest extends AbstractFileTest } @Test - public void testExecuteReportingService() throws Exception + public void testExecuteReportingServiceWithSpecifiedDataStore() throws Exception { // Given String dataSetCode = registerDataSet(); @@ -152,6 +153,28 @@ public class ReportingServiceTest extends AbstractFileTest as.logout(sessionToken); } + @Test + public void testExecuteReportingService() throws Exception + { + // Given + String dataSetCode = registerDataSet(); + String sessionToken = as.login(TEST_USER, PASSWORD); + DssServicePermId id = new DssServicePermId("example-jython-report"); + ReportingServiceExecutionOptions options = new ReportingServiceExecutionOptions(); + options.withDataSets(dataSetCode); + + // When + TableModel tableModel = as.executeReportingService(sessionToken, id, options); + + // Then + assertEquals("[Data Set, Data Set Type]", tableModel.getColumns().toString()); + assertEquals("[[" + dataSetCode + ", UNKNOWN]]", tableModel.getRows().toString()); + assertEquals(tableModel.getRows().get(0).get(0).getClass(), TableStringCell.class); + assertEquals(tableModel.getRows().get(0).get(1).getClass(), TableStringCell.class); + + as.logout(sessionToken); + } + @Test public void testExecuteUnknownReportingService() throws Exception { diff --git a/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/common.js b/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/common.js index 8b2033c55333b4dc27695bb507a9048405f32b33..8802daed52ec5f6558b181c44cf8f9fdf90f8568 100644 --- a/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/common.js +++ b/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/common.js @@ -81,7 +81,6 @@ define( this.MaterialDeletionOptions = dtos.MaterialDeletionOptions; this.PluginDeletionOptions = dtos.PluginDeletionOptions; this.VocabularyTermDeletionOptions = dtos.VocabularyTermDeletionOptions; - this.EntityTypeDeletionOptions = dtos.EntityTypeDeletionOptions; this.ExternalDmsDeletionOptions = dtos.ExternalDmsDeletionOptions; this.TagDeletionOptions = dtos.TagDeletionOptions; this.AuthorizationGroupDeletionOptions = dtos.AuthorizationGroupDeletionOptions; @@ -315,7 +314,6 @@ define( this.DeleteSampleTypesOperation = dtos.DeleteSampleTypesOperation; this.DeleteDataSetTypesOperation = dtos.DeleteDataSetTypesOperation; this.DeleteMaterialTypesOperation = dtos.DeleteMaterialTypesOperation; - this.DeleteEntityTypesOperation = dtos.DeleteEntityTypesOperation; this.DeleteTagsOperation = dtos.DeleteTagsOperation; this.DeleteAuthorizationGroupsOperation = dtos.DeleteAuthorizationGroupsOperation; this.DeleteRoleAssignmentsOperation = dtos.DeleteRoleAssignmentsOperation; @@ -1055,13 +1053,6 @@ define( return facade.deleteMaterialTypes([ id ], options); }.bind(this); - this.deleteEntityType = function(facade, id) { - var c = this; - var options = new dtos.EntityTypeDeletionOptions(); - options.setReason("test reason"); - return facade.deleteEntityTypes([ id ], options); - }.bind(this); - this.deletePlugin = function(facade, id) { var c = this; var options = new dtos.PluginDeletionOptions(); diff --git a/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/test-dss-services.js b/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/test-dss-services.js index f6c6377930a8593ecf9c9cdb39c027d651cda935..f5ce0bdafdff2657eda1dcc7059a71c1ab9d8241 100644 --- a/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/test-dss-services.js +++ b/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/test-dss-services.js @@ -212,7 +212,7 @@ define([ 'jquery', 'underscore', 'openbis', 'test/openbis-execute-operations', ' dataSetCode = permId; var serviceId = new c.DssServicePermId("test-reporting-service", new c.DataStorePermId("DSS1")); var options = new c.ReportingServiceExecutionOptions(); - options.withDataSets([dataSetCode]); + options.withDataSets(dataSetCode); return facade.executeReportingService(serviceId, options); }); } diff --git a/openbis/resource/server/bis-common.xml b/openbis/resource/server/bis-common.xml index 85934415b690e825409e2efe08f75abd3755930c..b7f83dd0102db34f719b92a5a1b917f17a90ffaa 100644 --- a/openbis/resource/server/bis-common.xml +++ b/openbis/resource/server/bis-common.xml @@ -14,6 +14,19 @@ </listener-class> </listener> + <filter> + <filter-name>HeaderFilter</filter-name> + <filter-class>ch.systemsx.cisd.common.servlet.HeaderFilter</filter-class> + <init-param> + <param-name>X-Frame-Options</param-name> + <param-value>SAMEORIGIN</param-value> + </init-param> + </filter> + <filter-mapping> + <filter-name>HeaderFilter</filter-name> + <url-pattern>/*</url-pattern> + </filter-mapping> + <filter> <filter-name>CacheFilter</filter-name> <filter-class>ch.systemsx.cisd.openbis.generic.server.CacheFilter</filter-class> diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/dataset/CreateDataSetTypesExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/dataset/CreateDataSetTypesExecutor.java index c938d62c3e6a6d1ca8293c1c734e75989b13e51f..1454df00f7266d6084003723668bef9f952b299d 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/dataset/CreateDataSetTypesExecutor.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/dataset/CreateDataSetTypesExecutor.java @@ -16,12 +16,15 @@ package ch.ethz.sis.openbis.generic.server.asapi.v3.executor.dataset; +import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.create.DataSetTypeCreation; import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.IOperationContext; import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.entity.AbstractCreateEntityTypeExecutor; +import ch.systemsx.cisd.openbis.generic.server.DataStoreServiceRegistrator; +import ch.systemsx.cisd.openbis.generic.server.IDataStoreServiceRegistrator; import ch.systemsx.cisd.openbis.generic.server.business.bo.IEntityTypeBO; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetType; import ch.systemsx.cisd.openbis.generic.shared.dto.DataSetTypePE; @@ -32,12 +35,19 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.properties.EntityKind; */ @Component public class CreateDataSetTypesExecutor extends AbstractCreateEntityTypeExecutor<DataSetTypeCreation, DataSetType, DataSetTypePE> - implements ICreateDataSetTypeExecutor + implements ICreateDataSetTypeExecutor, InitializingBean { - @Autowired private IDataSetTypeAuthorizationExecutor authorizationExecutor; + private IDataStoreServiceRegistrator dataStoreServiceRegistrator; + + @Override + public void afterPropertiesSet() throws Exception + { + dataStoreServiceRegistrator = new DataStoreServiceRegistrator(daoFactory); + } + @Override protected ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityKind getPEEntityKind() { @@ -75,6 +85,7 @@ public class CreateDataSetTypesExecutor extends AbstractCreateEntityTypeExecutor IEntityTypeBO typeBO = businessObjectFactory.createEntityTypeBO(context.getSession()); typeBO.define(type); typeBO.save(); + dataStoreServiceRegistrator.register(type); } @Override diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/entity/AbstractCreateEntityTypeExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/entity/AbstractCreateEntityTypeExecutor.java index 4961683ca576799e172fb0e8f45009bcac6f39fc..0acad5bb582748b45b161472336ec90bee3732cc 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/entity/AbstractCreateEntityTypeExecutor.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/entity/AbstractCreateEntityTypeExecutor.java @@ -58,7 +58,7 @@ public abstract class AbstractCreateEntityTypeExecutor<CREATION extends IEntityT { @Autowired - private IDAOFactory daoFactory; + protected IDAOFactory daoFactory; @Resource(name = ComponentNames.COMMON_BUSINESS_OBJECT_FACTORY) protected ICommonBusinessObjectFactory businessObjectFactory; diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/service/AbstractDssServiceExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/service/AbstractDssServiceExecutor.java index 541211a1050e44f41a510de044394269c05db088..b82a69140a7d0158669412446cccf39a1159314a 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/service/AbstractDssServiceExecutor.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/service/AbstractDssServiceExecutor.java @@ -43,7 +43,6 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.TableModelRow; /** * @author Franz-Josef Elmer - * */ abstract class AbstractDssServiceExecutor { @@ -63,54 +62,61 @@ abstract class AbstractDssServiceExecutor throw new UserFailureException("Service key cannot be empty."); } IDataStoreId dataStoreId = permId.getDataStoreId(); - if (dataStoreId == null) - { - throw new UserFailureException("Data store id cannot be null."); - } - if (dataStoreId instanceof DataStorePermId == false) - { - throw new UserFailureException("Unknown data store id type: " + dataStoreId.getClass().getName()); - } - if (StringUtils.isBlank(((DataStorePermId) dataStoreId).getPermId())) + if (dataStoreId != null) { - throw new UserFailureException("Data store code cannot be empty."); + if (dataStoreId instanceof DataStorePermId == false) + { + throw new UserFailureException("Unknown data store id type: " + dataStoreId.getClass().getName()); + } + if (StringUtils.isBlank(((DataStorePermId) dataStoreId).getPermId())) + { + throw new UserFailureException("Data store code cannot be empty."); + } } } protected TableModel translate(ch.systemsx.cisd.openbis.generic.shared.basic.dto.TableModel tableModel) { - List<TableModelColumnHeader> headers = tableModel.getHeader(); - List<TableColumn> columns = new ArrayList<>(headers.size()); - for (TableModelColumnHeader header : headers) - { - columns.add(new TableColumn(header.getTitle())); - } - SimpleDateFormat format = new SimpleDateFormat(BasicConstant.CANONICAL_DATE_FORMAT_PATTERN); - List<TableModelRow> rows = tableModel.getRows(); - List<List<ITableCell>> translatedRows = new ArrayList<>(rows.size()); - for (TableModelRow row : rows) + ArrayList<TableColumn> columns = new ArrayList<>(); + ArrayList<List<ITableCell>> translatedRows = new ArrayList<>(); + if (tableModel != null && tableModel.getHeader() != null && tableModel.getRows() != null) { - List<ISerializableComparable> values = row.getValues(); - List<ITableCell> cells = new ArrayList<>(values.size()); - for (ISerializableComparable value : values) + List<TableModelColumnHeader> headers = tableModel.getHeader(); + columns.ensureCapacity(headers.size()); + for (TableModelColumnHeader header : headers) { - ITableCell cell = null; - if (value instanceof IntegerTableCell) - { - cell = new TableLongCell(((IntegerTableCell) value).getNumber()); - } else if (value instanceof DoubleTableCell) - { - cell = new TableDoubleCell(((DoubleTableCell) value).getNumber()); - } else if (value instanceof DateTableCell) - { - cell = new TableStringCell(format.format(((DateTableCell) value).getDateTime())); - } else if (value != null) + columns.add(new TableColumn(header.getTitle())); + } + SimpleDateFormat format = new SimpleDateFormat(BasicConstant.CANONICAL_DATE_FORMAT_PATTERN); + List<TableModelRow> rows = tableModel.getRows(); + translatedRows.ensureCapacity(rows.size()); + for (TableModelRow row : rows) + { + List<ISerializableComparable> values = row.getValues(); + if (values != null) { - cell = new TableStringCell(value.toString()); + List<ITableCell> cells = new ArrayList<>(values.size()); + for (ISerializableComparable value : values) + { + ITableCell cell = null; + if (value instanceof IntegerTableCell) + { + cell = new TableLongCell(((IntegerTableCell) value).getNumber()); + } else if (value instanceof DoubleTableCell) + { + cell = new TableDoubleCell(((DoubleTableCell) value).getNumber()); + } else if (value instanceof DateTableCell) + { + cell = new TableStringCell(format.format(((DateTableCell) value).getDateTime())); + } else if (value != null) + { + cell = new TableStringCell(value.toString()); + } + cells.add(cell); + } + translatedRows.add(cells); } - cells.add(cell); } - translatedRows.add(cells); } return new TableModel(columns, translatedRows); } diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/service/ExecuteAggregationServiceExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/service/ExecuteAggregationServiceExecutor.java index 7a4f3ca1cf9e135f08ed786e3658dc8ebd1b67db..3b8e0e3d3aae16f17bc2ac816e79d0dd09e98209 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/service/ExecuteAggregationServiceExecutor.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/service/ExecuteAggregationServiceExecutor.java @@ -22,11 +22,13 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import ch.ethz.sis.openbis.generic.asapi.v3.dto.datastore.id.DataStorePermId; +import ch.ethz.sis.openbis.generic.asapi.v3.dto.datastore.id.IDataStoreId; import ch.ethz.sis.openbis.generic.asapi.v3.dto.service.execute.AggregationServiceExecutionOptions; import ch.ethz.sis.openbis.generic.asapi.v3.dto.service.execute.TableModel; import ch.ethz.sis.openbis.generic.asapi.v3.dto.service.id.DssServicePermId; import ch.ethz.sis.openbis.generic.asapi.v3.dto.service.id.IDssServiceId; import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.IOperationContext; +import ch.systemsx.cisd.common.exceptions.UserFailureException; import ch.systemsx.cisd.openbis.generic.server.ComponentNames; import ch.systemsx.cisd.openbis.generic.server.business.bo.ICommonBusinessObjectFactory; import ch.systemsx.cisd.openbis.generic.server.business.bo.IDataSetTable; @@ -56,4 +58,15 @@ public class ExecuteAggregationServiceExecutor extends AbstractDssServiceExecuto return translate(dataSetTable.createReportFromAggregationService(key, datastoreCode, options.getParameters())); } + @Override + protected void checkData(IDssServiceId serviceId) + { + super.checkData(serviceId); + IDataStoreId dataStoreId = ((DssServicePermId) serviceId).getDataStoreId(); + if (dataStoreId == null) + { + throw new UserFailureException("Data store id cannot be null."); + } + } + } diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/service/ExecuteProcessingServiceExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/service/ExecuteProcessingServiceExecutor.java index 28e545f80c42bbbfa45e2df74792f361b323c959..240ae48f6a2f1570875e619e0bff1a61a0701231 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/service/ExecuteProcessingServiceExecutor.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/service/ExecuteProcessingServiceExecutor.java @@ -16,12 +16,16 @@ package ch.ethz.sis.openbis.generic.server.asapi.v3.executor.service; +import java.util.List; +import java.util.Map; + import javax.annotation.Resource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import ch.ethz.sis.openbis.generic.asapi.v3.dto.datastore.id.DataStorePermId; +import ch.ethz.sis.openbis.generic.asapi.v3.dto.datastore.id.IDataStoreId; import ch.ethz.sis.openbis.generic.asapi.v3.dto.service.execute.ProcessingServiceExecutionOptions; import ch.ethz.sis.openbis.generic.asapi.v3.dto.service.id.DssServicePermId; import ch.ethz.sis.openbis.generic.asapi.v3.dto.service.id.IDssServiceId; @@ -48,12 +52,20 @@ public class ExecuteProcessingServiceExecutor public void execute(IOperationContext context, IDssServiceId serviceId, ProcessingServiceExecutionOptions options) { checkData(serviceId, options); - authorizationExecutor.canExecute(context, options.getDataSetCodes()); + List<String> dataSetCodes = options.getDataSetCodes(); + authorizationExecutor.canExecute(context, dataSetCodes); IDataSetTable dataSetTable = businessObjectFactory.createDataSetTable(context.getSession()); DssServicePermId permId = (DssServicePermId) serviceId; String key = permId.getPermId(); - String datastoreCode = ((DataStorePermId) permId.getDataStoreId()).getPermId(); - dataSetTable.processDatasets(key, datastoreCode, options.getDataSetCodes(), options.getParameters()); + IDataStoreId dataStoreId = permId.getDataStoreId(); + Map<String, String> parameters = options.getParameters(); + if (dataStoreId instanceof DataStorePermId) + { + dataSetTable.processDatasets(key, ((DataStorePermId) dataStoreId).getPermId(), dataSetCodes, parameters); + } else + { + dataSetTable.processDatasets(key, dataSetCodes, parameters); + } } } diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/service/ExecuteReportingServiceExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/service/ExecuteReportingServiceExecutor.java index b1ab79cb2f6dd691a3523270ff1490f923369816..cb22400b3e16254c5de39af2f1fdd9b7c5ef7e2f 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/service/ExecuteReportingServiceExecutor.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/service/ExecuteReportingServiceExecutor.java @@ -22,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import ch.ethz.sis.openbis.generic.asapi.v3.dto.datastore.id.DataStorePermId; +import ch.ethz.sis.openbis.generic.asapi.v3.dto.datastore.id.IDataStoreId; import ch.ethz.sis.openbis.generic.asapi.v3.dto.service.execute.ReportingServiceExecutionOptions; import ch.ethz.sis.openbis.generic.asapi.v3.dto.service.execute.TableModel; import ch.ethz.sis.openbis.generic.asapi.v3.dto.service.id.DssServicePermId; @@ -54,8 +55,16 @@ public class ExecuteReportingServiceExecutor IDataSetTable dataSetTable = businessObjectFactory.createDataSetTable(context.getSession()); DssServicePermId permId = (DssServicePermId) serviceId; String key = permId.getPermId(); - String datastoreCode = ((DataStorePermId) permId.getDataStoreId()).getPermId(); - return translate(dataSetTable.createReportFromDatasets(key, datastoreCode, options.getDataSetCodes())); + IDataStoreId dataStoreId = permId.getDataStoreId(); + if (dataStoreId instanceof DataStorePermId) + { + DataStorePermId n = (DataStorePermId) dataStoreId; + String dataStoreCode = n.getPermId(); + return translate(dataSetTable.createReportFromDatasets(key, dataStoreCode, options.getDataSetCodes())); + } else + { + return translate(dataSetTable.createReportFromDatasets(key, options.getDataSetCodes())); + } } } diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/service/ProcessingServiceAuthorizationExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/service/ProcessingServiceAuthorizationExecutor.java index a96acccffa8e8f9f2acba09d0af941147ca0cfda..ace11b5b96bc3b7b85f77d1a2479b8aaea3b9362 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/service/ProcessingServiceAuthorizationExecutor.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/service/ProcessingServiceAuthorizationExecutor.java @@ -43,7 +43,7 @@ public class ProcessingServiceAuthorizationExecutor implements IProcessingServic } @Override - @RolesAllowed({ RoleWithHierarchy.PROJECT_OBSERVER }) + @RolesAllowed({ RoleWithHierarchy.PROJECT_USER }) @Capability("EXECUTE_PROCESSING_SERVICES") public void canExecute(IOperationContext context, @AuthorizationGuard(guardClass = DataSetCodeCollectionPredicate.class) List<String> dataSetCodes) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/service/execute/ProcessingServiceExecutionOptions.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/service/execute/ProcessingServiceExecutionOptions.js index cbe328d016c0ee27a5c5889a287cf0d57ff00d4f..dfb463fec417622a52661d7a2fa6862905c0febd 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/service/execute/ProcessingServiceExecutionOptions.js +++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/service/execute/ProcessingServiceExecutionOptions.js @@ -3,12 +3,16 @@ define([ "stjs", "as/dto/service/execute/AbstractExecutionOptionsWithParameters" AbstractExecutionOptionsWithParameters.call(this); this.dataSetCodes = []; }; - stjs.extend(ProcessingServiceExecutionOptions, null, [ ], function(constructor, prototype) { + stjs.extend(ProcessingServiceExecutionOptions, AbstractExecutionOptionsWithParameters, [AbstractExecutionOptionsWithParameters], function(constructor, prototype) { prototype['@type'] = 'as.dto.service.execute.ProcessingServiceExecutionOptions'; constructor.serialVersionUID = 1; prototype.dataSetCodes = null; prototype.withDataSets = function(dataSetCodes) { - this.dataSetCodes = dataSetCodes; + if (Object.prototype.toString.call( dataSetCodes ) === '[object Array]' ) { + this.dataSetCodes = this.dataSetCodes.concat(dataSetCodes); + } else { + this.dataSetCodes.push(dataSetCodes); + } }; prototype.getDataSetCodes = function() { return this.dataSetCodes; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/service/execute/ReportingServiceExecutionOptions.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/service/execute/ReportingServiceExecutionOptions.js index 33a4f7067b2907476315586953fc36d307062043..375c988347351c91fcfe8a3445d0de8d5580d959 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/service/execute/ReportingServiceExecutionOptions.js +++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/service/execute/ReportingServiceExecutionOptions.js @@ -7,7 +7,11 @@ define([ "stjs"], function(stjs) { constructor.serialVersionUID = 1; prototype.dataSetCodes = null; prototype.withDataSets = function(dataSetCodes) { - this.dataSetCodes = dataSetCodes; + if (Object.prototype.toString.call( dataSetCodes ) === '[object Array]' ) { + this.dataSetCodes = this.dataSetCodes.concat(dataSetCodes); + } else { + this.dataSetCodes.push(dataSetCodes); + } }; prototype.getDataSetCodes = function() { return this.dataSetCodes; diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/CommonServerTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/CommonServerTest.java index 7b5e16a3bf7a6c2ee36417a3130cebe08c90b73c..2c81d317054df145084aa61c5ff653722e2d8aa0 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/CommonServerTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/CommonServerTest.java @@ -2107,7 +2107,7 @@ public class CommonServerTest extends SystemTestCase commonServer.createReportFromDatasets(session.getSessionToken(), serviceKey, Arrays.asList(dataSetCode)); } catch (Exception e) { - assertEquals(e.getMessage(), "Data store 'STANDARD' does not have '" + serviceKey + "' report configured."); + assertEquals(e.getMessage(), "Data store 'STANDARD' does not have '" + serviceKey + "' reporting plugin configured."); } } else { diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/authorization/CommonAuthorizationSystemTestService.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/authorization/CommonAuthorizationSystemTestService.java index 925891f6641aa0301fbc57f3a750e0640bb15c14..57c6a533170bfe109056cba8bdb3707b2f834b28 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/authorization/CommonAuthorizationSystemTestService.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/authorization/CommonAuthorizationSystemTestService.java @@ -26,10 +26,13 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; +import ch.systemsx.cisd.openbis.generic.server.DataStoreServiceRegistrator; +import ch.systemsx.cisd.openbis.generic.server.IDataStoreServiceRegistrator; import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory; import ch.systemsx.cisd.openbis.generic.shared.ICommonServer; import ch.systemsx.cisd.openbis.generic.shared.basic.IIdHolder; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Deletion; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DeletionType; import ch.systemsx.cisd.openbis.generic.shared.dto.DataPE; @@ -66,6 +69,17 @@ public class CommonAuthorizationSystemTestService private ICommonServer commonServer; private List<IIdHolder> createdObjects; + + private IDataStoreServiceRegistrator dataStoreServiceRegistrator; + + private IDataStoreServiceRegistrator getDataStoreServiceRegistrator() + { + if (dataStoreServiceRegistrator == null) + { + dataStoreServiceRegistrator = new DataStoreServiceRegistrator(daoFactory); + } + return dataStoreServiceRegistrator; + } @Transactional public void createPerson(PersonPE person) @@ -115,6 +129,12 @@ public class CommonAuthorizationSystemTestService public void createType(EntityTypePE entityType, EntityKind entityKind) { daoFactory.getEntityTypeDAO(entityKind).createOrUpdateEntityType(entityType); + if (EntityKind.DATA_SET.equals(entityKind)) + { + DataSetType dataSetType = new DataSetType(); + dataSetType.setCode(entityType.getCode()); + getDataStoreServiceRegistrator().register(dataSetType); + } createdObjects.add(entityType); } diff --git a/openbis_all/source/bash/build/branch.sh b/openbis_all/source/bash/build/branch.sh index c433d8f0eeba80940fdf08696913fb1be45b83cf..576581e2a327a4dff4e20b2da804148c84dee0e4 100755 --- a/openbis_all/source/bash/build/branch.sh +++ b/openbis_all/source/bash/build/branch.sh @@ -10,7 +10,7 @@ then fi # exit if branch already exists -branch_heads=`git ls-remote --heads git@sissource.ethz.ch:sis/openbis.git $1` +branch_heads=`git ls-remote --heads git@sissource.ethz.ch:sispub/openbis.git $1` if [ -n "$branch_heads" ]; then echo "Branch already exists!" exit 1 diff --git a/openbis_all/source/bash/build/build.sh b/openbis_all/source/bash/build/build.sh index 9744734ce2614d2cbd51c4712fa72e6dde7de258..769c63088399140ccb669cdf8d40c23777cd2f10 100755 --- a/openbis_all/source/bash/build/build.sh +++ b/openbis_all/source/bash/build/build.sh @@ -37,12 +37,12 @@ if [ $? -ne 0 ]; then echo "Tag does not exist!"; exit 1; fi # build cd openbis_standard_technologies -./gradlew :clientsAndApis -x test -./gradlew :generateJavadoc +./gradlew :clean :clientsAndApis -x test +./gradlew :clean :generateJavadoc cd ../installation -./gradlew :build -x test +./gradlew :clean :build -x test cd ../plasmid -./gradlew :build -x test +./gradlew :clean :build -x test cd ../.. diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/service/execute/AbstractExecutionOptionsWithParameters.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/service/execute/AbstractExecutionOptionsWithParameters.java index 91a170c94478989bbd97bf86885906d1dce732d5..3e71de2ce6a9e3547ac4eff45f28e6325e63000f 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/service/execute/AbstractExecutionOptionsWithParameters.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/service/execute/AbstractExecutionOptionsWithParameters.java @@ -45,4 +45,10 @@ public abstract class AbstractExecutionOptionsWithParameters<EO extends Abstract return parameters; } + @Override + public String toString() + { + return getClass().getSimpleName() + ": parameters=" + parameters; + } + } diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/service/execute/ProcessingServiceExecutionOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/service/execute/ProcessingServiceExecutionOptions.java index 2c4506c7107a3a6ed6b0996008fee2308d93c398..962578beb4a1dc0938d27bf3bdbdaf2905ea330f 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/service/execute/ProcessingServiceExecutionOptions.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/service/execute/ProcessingServiceExecutionOptions.java @@ -52,4 +52,10 @@ public class ProcessingServiceExecutionOptions return dataSetCodes; } + @Override + public String toString() + { + return super.toString() + ", data sets=" + dataSetCodes; + } + } diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/service/execute/ReportingServiceExecutionOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/service/execute/ReportingServiceExecutionOptions.java index fd6caa7b40c1ca314ef0f35a306f10ee834d04ca..29f465fca3160c7a5fbfacf0c4bf219b43121a4b 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/service/execute/ReportingServiceExecutionOptions.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/service/execute/ReportingServiceExecutionOptions.java @@ -51,4 +51,10 @@ public class ReportingServiceExecutionOptions implements Serializable, IDataSetC return dataSetCodes; } + @Override + public String toString() + { + return getClass().getSimpleName() + ": data sets=" + dataSetCodes; + } + } diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/service/execute/SearchDomainServiceExecutionOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/service/execute/SearchDomainServiceExecutionOptions.java index 6d12a23f09b9febc36c4d0fd1a3eb2c78cf5eb12..87da62444aa538965f0748ff9d0c822affd6ed3f 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/service/execute/SearchDomainServiceExecutionOptions.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/service/execute/SearchDomainServiceExecutionOptions.java @@ -53,4 +53,19 @@ public class SearchDomainServiceExecutionOptions extends AbstractExecutionOption return searchString; } + @Override + public String toString() + { + StringBuilder builder = new StringBuilder(super.toString()); + if (searchString != null) + { + builder.append(", search string='").append(searchString).append("'"); + } + if (preferredSearchDomain != null) + { + builder.append(", preferred serach domain=").append(preferredSearchDomain); + } + return builder.toString(); + } + } diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/service/id/DssServicePermId.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/service/id/DssServicePermId.java index 959be45f2bb4b2357c09fb92f377088f5512b4f0..5f83f235e5f7e03fd234fbb8973307799a272981 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/service/id/DssServicePermId.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/service/id/DssServicePermId.java @@ -33,21 +33,22 @@ public class DssServicePermId extends ObjectPermId implements IDssServiceId @JsonProperty private IDataStoreId dataStoreId; + + public DssServicePermId(String permId) + { + this(permId, null); + } public DssServicePermId(String permId, IDataStoreId dataStoreId) { super(permId); - if (dataStoreId == null) - { - throw new IllegalArgumentException("Data store id cannot be null."); - } this.dataStoreId = dataStoreId; } @Override public String toString() { - return dataStoreId + ":" + super.toString(); + return dataStoreId == null ? super.toString() : dataStoreId + ":" + super.toString(); } @Override diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/dss/reporting-plugins/exports-api/exports-api.py b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/dss/reporting-plugins/exports-api/exports-api.py index ba912cf8d232b5daee7614c97f53b39b781b282c..28e199de7ec1a2058de164a844a54d93aac3ea2d 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/dss/reporting-plugins/exports-api/exports-api.py +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/dss/reporting-plugins/exports-api/exports-api.py @@ -595,7 +595,7 @@ def getFilePath(spaceCode, projCode, expCode, sampCode, dataCode): def addToZipFile(path, file, zos): fis = FileInputStream(file); - zipEntry = ZipEntry(path); + zipEntry = ZipEntry(path[1:]); # Making paths relative to make them compatible with Windows zip implementation zos.putNextEntry(zipEntry); bytes = jarray.zeros(1024, "b"); diff --git a/openbis_standard_technologies/resource/server/jetty-web.xml b/openbis_standard_technologies/resource/server/jetty-web.xml index 0ddbc770e44fa5ba1c66e97fcfca0ee7f0777d70..c5d95dbcbaf382e28530bb2113e58d0d5c7fdc34 100644 --- a/openbis_standard_technologies/resource/server/jetty-web.xml +++ b/openbis_standard_technologies/resource/server/jetty-web.xml @@ -5,4 +5,9 @@ <Call name="addAliasCheck"> <Arg><New class="org.eclipse.jetty.server.handler.AllowSymLinkAliasChecker"/></Arg> </Call> + <Get name="sessionHandler"> + <Get name="sessionCookieConfig"> + <Set name="httpOnly" type="boolean">true</Set> + </Get> + </Get> </Configure> \ No newline at end of file