diff --git a/src/python/dm/__init__.py b/src/python/dm/__init__.py index 04562a4f370d198d704c23b11af3de2cf672d8ad..2ac2c5502f6a002cb7e7603af888cb0bcba8d64f 100644 --- a/src/python/dm/__init__.py +++ b/src/python/dm/__init__.py @@ -1 +1 @@ -__version__ = "0.15 (2016.10.26)" +__version__ = "0.16 (2017.01.05)" diff --git a/src/python/dm/cat_web_service/service/datasetSessionController.py b/src/python/dm/cat_web_service/service/datasetSessionController.py index 867b0737ab08b1f0f8245c140ce8c9afe370bed3..b5b3f42b138d8b18ee71029b0ba821e0a7d602db 100755 --- a/src/python/dm/cat_web_service/service/datasetSessionController.py +++ b/src/python/dm/cat_web_service/service/datasetSessionController.py @@ -13,7 +13,7 @@ class DatasetSessionController(DmSessionController): self.datasetSessionControllerImpl = DatasetSessionControllerImpl() @cherrypy.expose - @DmSessionController.require(DmSessionController.isAdministrator()) + @DmSessionController.require(DmSessionController.canManageStation()) @DmSessionController.execute def addExperimentDataset(self, experimentName, datasetName, **kwargs): if not experimentName: @@ -31,7 +31,7 @@ class DatasetSessionController(DmSessionController): return response @cherrypy.expose - @DmSessionController.require(DmSessionController.isAdministrator()) + @DmSessionController.require(DmSessionController.canManageStation()) @DmSessionController.execute def updateExperimentDataset(self, experimentName, datasetName, **kwargs): if not experimentName: @@ -49,7 +49,7 @@ class DatasetSessionController(DmSessionController): return response @cherrypy.expose - @DmSessionController.require(DmSessionController.isAdministrator()) + @DmSessionController.require(DmSessionController.canManageStation()) @DmSessionController.execute def updateDatasetById(self, id, **kwargs): if not id: @@ -63,7 +63,7 @@ class DatasetSessionController(DmSessionController): return response @cherrypy.expose - @DmSessionController.require(DmSessionController.isAdministrator()) + @DmSessionController.require(DmSessionController.canManageStation()) @DmSessionController.execute def getDatasets(self, **kwargs): encodedQueryDict = kwargs.get('queryDict') @@ -73,7 +73,7 @@ class DatasetSessionController(DmSessionController): return self.listToJson(self.datasetSessionControllerImpl.getDatasets(queryDict=queryDict)) @cherrypy.expose - @DmSessionController.require(DmSessionController.isAdministrator()) + @DmSessionController.require(DmSessionController.canManageStation()) @DmSessionController.execute def getExperimentDatasets(self, experimentName, **kwargs): if not experimentName: @@ -85,7 +85,7 @@ class DatasetSessionController(DmSessionController): return self.listToJson(self.datasetSessionControllerImpl.getExperimentDatasets(experimentName, queryDict=queryDict)) @cherrypy.expose - @DmSessionController.require(DmSessionController.isAdministrator()) + @DmSessionController.require(DmSessionController.canManageStation()) @DmSessionController.execute def getDatasetById(self, id, **kwargs): if not id: @@ -95,7 +95,7 @@ class DatasetSessionController(DmSessionController): return response @cherrypy.expose - @DmSessionController.require(DmSessionController.isAdministrator()) + @DmSessionController.require(DmSessionController.canManageStation()) @DmSessionController.execute def getExperimentDataset(self, experimentName, datasetName, **kwargs): if not experimentName: @@ -107,7 +107,7 @@ class DatasetSessionController(DmSessionController): return response @cherrypy.expose - @DmSessionController.require(DmSessionController.isAdministrator()) + @DmSessionController.require(DmSessionController.canManageStation()) @DmSessionController.execute def getExperimentDatasetFiles(self, experimentName, datasetName, **kwargs): if not experimentName: diff --git a/src/python/dm/cat_web_service/service/fileSessionController.py b/src/python/dm/cat_web_service/service/fileSessionController.py index ec9db79df813ad713caa0ae408fe42400c1dc67f..3836ce6cd1f46e3813d18408298a84b188994cdc 100755 --- a/src/python/dm/cat_web_service/service/fileSessionController.py +++ b/src/python/dm/cat_web_service/service/fileSessionController.py @@ -13,7 +13,7 @@ class FileSessionController(DmSessionController): self.fileSessionControllerImpl = FileSessionControllerImpl() @cherrypy.expose - @DmSessionController.require(DmSessionController.isAdministrator()) + @DmSessionController.require(DmSessionController.canManageStation()) @DmSessionController.execute def addExperimentFile(self, experimentName, encodedExperimentFilePath, **kwargs): if not experimentName: @@ -32,7 +32,7 @@ class FileSessionController(DmSessionController): return response @cherrypy.expose - @DmSessionController.require(DmSessionController.isAdministrator()) + @DmSessionController.require(DmSessionController.canManageStation()) @DmSessionController.execute def updateExperimentFile(self, experimentName, encodedExperimentFilePath, **kwargs): if not experimentName: @@ -51,7 +51,7 @@ class FileSessionController(DmSessionController): return response @cherrypy.expose - @DmSessionController.require(DmSessionController.isAdministrator()) + @DmSessionController.require(DmSessionController.canManageStation()) @DmSessionController.execute def updateExperimentFileById(self, expermentName, id, **kwargs): if not experimentName: @@ -68,7 +68,7 @@ class FileSessionController(DmSessionController): return response @cherrypy.expose - @DmSessionController.require(DmSessionController.isAdministrator()) + @DmSessionController.require(DmSessionController.canManageStation()) @DmSessionController.execute def getExperimentFiles(self, experimentName, **kwargs): if not experimentName: @@ -80,7 +80,7 @@ class FileSessionController(DmSessionController): return self.listToJson(self.fileSessionControllerImpl.getExperimentFiles(experimentName, queryDict=queryDict)) @cherrypy.expose - @DmSessionController.require(DmSessionController.isAdministrator()) + @DmSessionController.require(DmSessionController.canManageStation()) @DmSessionController.execute def getExperimentFileById(self, experimentName, id, **kwargs): if not experimentName: @@ -92,7 +92,7 @@ class FileSessionController(DmSessionController): return response @cherrypy.expose - @DmSessionController.require(DmSessionController.isAdministrator()) + @DmSessionController.require(DmSessionController.canManageStation()) @DmSessionController.execute def getExperimentFile(self, experimentName, encodedExperimentFilePath, **kwargs): if not experimentName: diff --git a/src/python/dm/daq_web_service/service/daqWebService.py b/src/python/dm/daq_web_service/service/daqWebService.py index edcb0ff41fa88c69623b7250d0ad929d63f0c0e9..7bd9ea8adb328eebc5237f91da6fdc62c6f860ff 100755 --- a/src/python/dm/daq_web_service/service/daqWebService.py +++ b/src/python/dm/daq_web_service/service/daqWebService.py @@ -14,7 +14,7 @@ from dm.daq_web_service.service.impl.fileSystemObserver import FileSystemObserve from daqWebServiceRouteMapper import DaqWebServiceRouteMapper class DaqWebService(DmRestWebServiceBase): - + def __init__(self): DmRestWebServiceBase.__init__(self, DaqWebServiceRouteMapper) diff --git a/src/python/dm/daq_web_service/service/experimentSessionController.py b/src/python/dm/daq_web_service/service/experimentSessionController.py index c0697e2a0c87896b7ced6a21a30781cc2ce1ad6c..53aa51b20f0e9f1c45d42d52bcf99b4b15fb8118 100755 --- a/src/python/dm/daq_web_service/service/experimentSessionController.py +++ b/src/python/dm/daq_web_service/service/experimentSessionController.py @@ -8,6 +8,7 @@ from dm.common.constants import dmProcessingMode from dm.common.constants import dmProcessingStatus from dm.common.service.dmSessionController import DmSessionController from dm.common.exceptions.invalidRequest import InvalidRequest +from dm.common.exceptions.authorizationError import AuthorizationError from dm.common.utility.encoder import Encoder from dm.common.utility.dictUtility import DictUtility @@ -21,7 +22,7 @@ class ExperimentSessionController(DmSessionController): self.experimentSessionControllerImpl = ExperimentSessionControllerImpl() @cherrypy.expose - @DmSessionController.require(DmSessionController.isAdministrator()) + @DmSessionController.require(DmSessionController.canManageStation()) @DmSessionController.execute def startDaq(self, experimentName, dataDirectory, **kwargs): if not experimentName: @@ -37,12 +38,13 @@ class ExperimentSessionController(DmSessionController): encodedDaqInfo = kwargs.get('daqInfo') if encodedDaqInfo is not None: daqInfo = json.loads(Encoder.decode(encodedDaqInfo)) + response = self.experimentSessionControllerImpl.startDaq(experimentName, dataDirectory, daqInfo).getFullJsonRep() - self.logger.debug('Returning: %s' % response) + self.logger.debug('Started DAQ: %s' % response) return response @cherrypy.expose - @DmSessionController.require(DmSessionController.isAdministrator()) + @DmSessionController.require(DmSessionController.canManageStation()) @DmSessionController.execute def stopDaq(self, experimentName, dataDirectory, **kwargs): if not experimentName: @@ -52,19 +54,18 @@ class ExperimentSessionController(DmSessionController): raise InvalidRequest('Missing data directory.') dataDirectory = Encoder.decode(dataDirectory) response = self.experimentSessionControllerImpl.stopDaq(experimentName, dataDirectory).getFullJsonRep() - self.logger.debug('Returning: %s' % response) + self.logger.debug('Stopped DAQ: %s' % response) return response @cherrypy.expose - @DmSessionController.require(DmSessionController.isAdministrator()) + @DmSessionController.require(DmSessionController.canManageStation()) @DmSessionController.execute def getDaqInfo(self, id, **kwargs): response = self.experimentSessionControllerImpl.getDaqInfo(id).getFullJsonRep() - self.logger.debug('Returning: %s' % response) return response @cherrypy.expose - @DmSessionController.require(DmSessionController.isAdministrator()) + @DmSessionController.require(DmSessionController.canManageStation()) @DmSessionController.execute def listDaqs(self, status=dmProcessingStatus.DM_PROCESSING_STATUS_ANY, **kwargs): if not status: @@ -74,7 +75,7 @@ class ExperimentSessionController(DmSessionController): return self.listToJson(self.experimentSessionControllerImpl.listDaqs(status)) @cherrypy.expose - @DmSessionController.require(DmSessionController.isAdministrator()) + @DmSessionController.require(DmSessionController.canManageStation()) @DmSessionController.execute def upload(self, experimentName, dataDirectory, **kwargs): if not experimentName: @@ -101,7 +102,7 @@ class ExperimentSessionController(DmSessionController): return response @cherrypy.expose - @DmSessionController.require(DmSessionController.isAdministrator()) + @DmSessionController.require(DmSessionController.canManageStation()) @DmSessionController.execute def getUploadInfo(self, id, **kwargs): response = self.experimentSessionControllerImpl.getUploadInfo(id).getFullJsonRep() @@ -109,7 +110,7 @@ class ExperimentSessionController(DmSessionController): return response @cherrypy.expose - @DmSessionController.require(DmSessionController.isAdministrator()) + @DmSessionController.require(DmSessionController.canManageStation()) @DmSessionController.execute def listUploads(self, status=dmProcessingStatus.DM_PROCESSING_STATUS_ANY, **kwargs): if not status: @@ -119,7 +120,7 @@ class ExperimentSessionController(DmSessionController): return self.listToJson(self.experimentSessionControllerImpl.listUploads(status)) @cherrypy.expose - @DmSessionController.require(DmSessionController.isAdministrator()) + @DmSessionController.require(DmSessionController.canManageStation()) @DmSessionController.execute def stopUpload(self, id, **kwargs): response = self.experimentSessionControllerImpl.stopUpload(id).getFullJsonRep() @@ -127,7 +128,7 @@ class ExperimentSessionController(DmSessionController): return response @cherrypy.expose - @DmSessionController.require(DmSessionController.isAdministrator()) + @DmSessionController.require(DmSessionController.canManageStation()) @DmSessionController.execute def getProcessingPlugins(self, **kwargs): return self.listToJson(self.experimentSessionControllerImpl.getProcessingPlugins())