From f8b4390266594c861f750a87bdecf541dd98d91a Mon Sep 17 00:00:00 2001 From: Alexander Stocker Date: Tue, 20 Jun 2017 22:04:36 +0200 Subject: [PATCH] Fixed Bug referring to Issue #19 reported by @user17476566786 and some other changes --- AUTHORS.md | 0 CHANGELOG.md | 6 +++ COPYING | 0 LICENSE | 0 Makefile | 0 README.md | 0 appinfo/app.php | 0 appinfo/autoload.php | 0 appinfo/database.xml | 0 appinfo/info.xml | 3 +- appinfo/routes.php | 0 controller/apisensorloggercontroller.php | 44 ++++++++++++++++-- controller/sensorloggercontroller.php | 0 css/jquery-editable.css | 0 css/style.css | 0 img/app.svg | 0 img/clear.png | Bin img/loading.gif | Bin img/save.svg | 0 js/app.js | 0 js/deviceactions.js | 0 js/jquery-editable-poshytip.min.js | 0 js/jquery.jqplot.min.js | 0 js/jquery.poshytip.min.js | 0 js/navigation.js | 0 js/plugins/jqplot.BezierCurveRenderer.js | 0 js/plugins/jqplot.BezierCurveRenderer.min.js | 0 js/plugins/jqplot.barRenderer.js | 0 js/plugins/jqplot.barRenderer.min.js | 0 js/plugins/jqplot.blockRenderer.js | 0 js/plugins/jqplot.blockRenderer.min.js | 0 js/plugins/jqplot.bubbleRenderer.js | 0 js/plugins/jqplot.bubbleRenderer.min.js | 0 js/plugins/jqplot.canvasAxisLabelRenderer.js | 0 .../jqplot.canvasAxisLabelRenderer.min.js | 0 js/plugins/jqplot.canvasAxisTickRenderer.js | 0 .../jqplot.canvasAxisTickRenderer.min.js | 0 js/plugins/jqplot.canvasOverlay.js | 0 js/plugins/jqplot.canvasOverlay.min.js | 0 js/plugins/jqplot.canvasTextRenderer.js | 0 js/plugins/jqplot.canvasTextRenderer.min.js | 0 js/plugins/jqplot.categoryAxisRenderer.js | 0 js/plugins/jqplot.categoryAxisRenderer.min.js | 0 js/plugins/jqplot.ciParser.js | 0 js/plugins/jqplot.ciParser.min.js | 0 js/plugins/jqplot.cursor.js | 0 js/plugins/jqplot.cursor.min.js | 0 js/plugins/jqplot.dateAxisRenderer.js | 0 js/plugins/jqplot.dateAxisRenderer.min.js | 0 js/plugins/jqplot.donutRenderer.js | 0 js/plugins/jqplot.donutRenderer.min.js | 0 js/plugins/jqplot.dragable.js | 0 js/plugins/jqplot.dragable.min.js | 0 js/plugins/jqplot.enhancedLegendRenderer.js | 0 .../jqplot.enhancedLegendRenderer.min.js | 0 js/plugins/jqplot.funnelRenderer.js | 0 js/plugins/jqplot.funnelRenderer.min.js | 0 js/plugins/jqplot.highlighter.js | 0 js/plugins/jqplot.highlighter.min.js | 0 js/plugins/jqplot.json2.js | 0 js/plugins/jqplot.json2.min.js | 0 js/plugins/jqplot.logAxisRenderer.js | 0 js/plugins/jqplot.logAxisRenderer.min.js | 0 js/plugins/jqplot.mekkoAxisRenderer.js | 0 js/plugins/jqplot.mekkoAxisRenderer.min.js | 0 js/plugins/jqplot.mekkoRenderer.js | 0 js/plugins/jqplot.mekkoRenderer.min.js | 0 js/plugins/jqplot.meterGaugeRenderer.js | 0 js/plugins/jqplot.meterGaugeRenderer.min.js | 0 js/plugins/jqplot.mobile.js | 0 js/plugins/jqplot.mobile.min.js | 0 js/plugins/jqplot.ohlcRenderer.js | 0 js/plugins/jqplot.ohlcRenderer.min.js | 0 js/plugins/jqplot.pieRenderer.js | 0 js/plugins/jqplot.pieRenderer.min.js | 0 js/plugins/jqplot.pointLabels.js | 0 js/plugins/jqplot.pointLabels.min.js | 0 js/plugins/jqplot.pyramidAxisRenderer.js | 0 js/plugins/jqplot.pyramidAxisRenderer.min.js | 0 js/plugins/jqplot.pyramidGridRenderer.js | 0 js/plugins/jqplot.pyramidGridRenderer.min.js | 0 js/plugins/jqplot.pyramidRenderer.js | 0 js/plugins/jqplot.pyramidRenderer.min.js | 0 js/plugins/jqplot.trendline.js | 0 js/plugins/jqplot.trendline.min.js | 0 js/script.js | 0 js/utils.js | 0 lib/App.php | 0 lib/DataType.php | 0 lib/DataTypes.php | 27 +++++++++++ lib/Device.php | 0 lib/DeviceTypes.php | 0 lib/Group.php | 0 lib/Log.php | 0 lib/LogExtended.php | 0 lib/SensorDevices.php | 0 lib/SensorGroups.php | 0 lib/SensorLogs.php | 0 lib/Type.php | 0 lib/Widget.php | 0 lib/Widgets.php | 0 phpunit.integration.xml | 0 phpunit.xml | 0 templates/main.php | 0 templates/part.chart.php | 0 templates/part.dashboard.php | 0 templates/part.list.php | 0 templates/part.listDataTypes.php | 0 templates/part.listDeviceGroups.php | 0 templates/part.listDeviceTypes.php | 0 templates/part.listDevices.php | 0 templates/part.listSharedDevices.php | 0 templates/part.navigation.php | 0 templates/part.settings.php | 0 templates/widget_dashboard.php | 0 tests/bootstrap.php | 0 tests/curl/createlog_example.json | 0 tests/curl/createlog_extend_example.json | 0 tests/curl/datatyperesponse.json | 0 tests/curl/getdatatypes.php | 0 tests/curl/post.php | 0 tests/curl/post_extend.php | 0 tests/curl/post_extend_0.php | 0 tests/curl/put.php | 0 tests/curl/register.php | 0 tests/curl/register_extend_0.php | 0 tests/curl/registerdevice_example.json | 0 tests/integration/AppTest.php | 0 128 files changed, 74 insertions(+), 6 deletions(-) mode change 100644 => 100755 AUTHORS.md mode change 100644 => 100755 CHANGELOG.md mode change 100644 => 100755 COPYING mode change 100644 => 100755 LICENSE mode change 100644 => 100755 Makefile mode change 100644 => 100755 README.md mode change 100644 => 100755 appinfo/app.php mode change 100644 => 100755 appinfo/autoload.php mode change 100644 => 100755 appinfo/database.xml mode change 100644 => 100755 appinfo/info.xml mode change 100644 => 100755 appinfo/routes.php mode change 100644 => 100755 controller/apisensorloggercontroller.php mode change 100644 => 100755 controller/sensorloggercontroller.php mode change 100644 => 100755 css/jquery-editable.css mode change 100644 => 100755 css/style.css mode change 100644 => 100755 img/app.svg mode change 100644 => 100755 img/clear.png mode change 100644 => 100755 img/loading.gif mode change 100644 => 100755 img/save.svg mode change 100644 => 100755 js/app.js mode change 100644 => 100755 js/deviceactions.js mode change 100644 => 100755 js/jquery-editable-poshytip.min.js mode change 100644 => 100755 js/jquery.jqplot.min.js mode change 100644 => 100755 js/jquery.poshytip.min.js mode change 100644 => 100755 js/navigation.js mode change 100644 => 100755 js/plugins/jqplot.BezierCurveRenderer.js mode change 100644 => 100755 js/plugins/jqplot.BezierCurveRenderer.min.js mode change 100644 => 100755 js/plugins/jqplot.barRenderer.js mode change 100644 => 100755 js/plugins/jqplot.barRenderer.min.js mode change 100644 => 100755 js/plugins/jqplot.blockRenderer.js mode change 100644 => 100755 js/plugins/jqplot.blockRenderer.min.js mode change 100644 => 100755 js/plugins/jqplot.bubbleRenderer.js mode change 100644 => 100755 js/plugins/jqplot.bubbleRenderer.min.js mode change 100644 => 100755 js/plugins/jqplot.canvasAxisLabelRenderer.js mode change 100644 => 100755 js/plugins/jqplot.canvasAxisLabelRenderer.min.js mode change 100644 => 100755 js/plugins/jqplot.canvasAxisTickRenderer.js mode change 100644 => 100755 js/plugins/jqplot.canvasAxisTickRenderer.min.js mode change 100644 => 100755 js/plugins/jqplot.canvasOverlay.js mode change 100644 => 100755 js/plugins/jqplot.canvasOverlay.min.js mode change 100644 => 100755 js/plugins/jqplot.canvasTextRenderer.js mode change 100644 => 100755 js/plugins/jqplot.canvasTextRenderer.min.js mode change 100644 => 100755 js/plugins/jqplot.categoryAxisRenderer.js mode change 100644 => 100755 js/plugins/jqplot.categoryAxisRenderer.min.js mode change 100644 => 100755 js/plugins/jqplot.ciParser.js mode change 100644 => 100755 js/plugins/jqplot.ciParser.min.js mode change 100644 => 100755 js/plugins/jqplot.cursor.js mode change 100644 => 100755 js/plugins/jqplot.cursor.min.js mode change 100644 => 100755 js/plugins/jqplot.dateAxisRenderer.js mode change 100644 => 100755 js/plugins/jqplot.dateAxisRenderer.min.js mode change 100644 => 100755 js/plugins/jqplot.donutRenderer.js mode change 100644 => 100755 js/plugins/jqplot.donutRenderer.min.js mode change 100644 => 100755 js/plugins/jqplot.dragable.js mode change 100644 => 100755 js/plugins/jqplot.dragable.min.js mode change 100644 => 100755 js/plugins/jqplot.enhancedLegendRenderer.js mode change 100644 => 100755 js/plugins/jqplot.enhancedLegendRenderer.min.js mode change 100644 => 100755 js/plugins/jqplot.funnelRenderer.js mode change 100644 => 100755 js/plugins/jqplot.funnelRenderer.min.js mode change 100644 => 100755 js/plugins/jqplot.highlighter.js mode change 100644 => 100755 js/plugins/jqplot.highlighter.min.js mode change 100644 => 100755 js/plugins/jqplot.json2.js mode change 100644 => 100755 js/plugins/jqplot.json2.min.js mode change 100644 => 100755 js/plugins/jqplot.logAxisRenderer.js mode change 100644 => 100755 js/plugins/jqplot.logAxisRenderer.min.js mode change 100644 => 100755 js/plugins/jqplot.mekkoAxisRenderer.js mode change 100644 => 100755 js/plugins/jqplot.mekkoAxisRenderer.min.js mode change 100644 => 100755 js/plugins/jqplot.mekkoRenderer.js mode change 100644 => 100755 js/plugins/jqplot.mekkoRenderer.min.js mode change 100644 => 100755 js/plugins/jqplot.meterGaugeRenderer.js mode change 100644 => 100755 js/plugins/jqplot.meterGaugeRenderer.min.js mode change 100644 => 100755 js/plugins/jqplot.mobile.js mode change 100644 => 100755 js/plugins/jqplot.mobile.min.js mode change 100644 => 100755 js/plugins/jqplot.ohlcRenderer.js mode change 100644 => 100755 js/plugins/jqplot.ohlcRenderer.min.js mode change 100644 => 100755 js/plugins/jqplot.pieRenderer.js mode change 100644 => 100755 js/plugins/jqplot.pieRenderer.min.js mode change 100644 => 100755 js/plugins/jqplot.pointLabels.js mode change 100644 => 100755 js/plugins/jqplot.pointLabels.min.js mode change 100644 => 100755 js/plugins/jqplot.pyramidAxisRenderer.js mode change 100644 => 100755 js/plugins/jqplot.pyramidAxisRenderer.min.js mode change 100644 => 100755 js/plugins/jqplot.pyramidGridRenderer.js mode change 100644 => 100755 js/plugins/jqplot.pyramidGridRenderer.min.js mode change 100644 => 100755 js/plugins/jqplot.pyramidRenderer.js mode change 100644 => 100755 js/plugins/jqplot.pyramidRenderer.min.js mode change 100644 => 100755 js/plugins/jqplot.trendline.js mode change 100644 => 100755 js/plugins/jqplot.trendline.min.js mode change 100644 => 100755 js/script.js mode change 100644 => 100755 js/utils.js mode change 100644 => 100755 lib/App.php mode change 100644 => 100755 lib/DataType.php mode change 100644 => 100755 lib/DataTypes.php mode change 100644 => 100755 lib/Device.php mode change 100644 => 100755 lib/DeviceTypes.php mode change 100644 => 100755 lib/Group.php mode change 100644 => 100755 lib/Log.php mode change 100644 => 100755 lib/LogExtended.php mode change 100644 => 100755 lib/SensorDevices.php mode change 100644 => 100755 lib/SensorGroups.php mode change 100644 => 100755 lib/SensorLogs.php mode change 100644 => 100755 lib/Type.php mode change 100644 => 100755 lib/Widget.php mode change 100644 => 100755 lib/Widgets.php mode change 100644 => 100755 phpunit.integration.xml mode change 100644 => 100755 phpunit.xml mode change 100644 => 100755 templates/main.php mode change 100644 => 100755 templates/part.chart.php mode change 100644 => 100755 templates/part.dashboard.php mode change 100644 => 100755 templates/part.list.php mode change 100644 => 100755 templates/part.listDataTypes.php mode change 100644 => 100755 templates/part.listDeviceGroups.php mode change 100644 => 100755 templates/part.listDeviceTypes.php mode change 100644 => 100755 templates/part.listDevices.php mode change 100644 => 100755 templates/part.listSharedDevices.php mode change 100644 => 100755 templates/part.navigation.php mode change 100644 => 100755 templates/part.settings.php mode change 100644 => 100755 templates/widget_dashboard.php mode change 100644 => 100755 tests/bootstrap.php mode change 100644 => 100755 tests/curl/createlog_example.json mode change 100644 => 100755 tests/curl/createlog_extend_example.json mode change 100644 => 100755 tests/curl/datatyperesponse.json mode change 100644 => 100755 tests/curl/getdatatypes.php mode change 100644 => 100755 tests/curl/post.php mode change 100644 => 100755 tests/curl/post_extend.php mode change 100644 => 100755 tests/curl/post_extend_0.php mode change 100644 => 100755 tests/curl/put.php mode change 100644 => 100755 tests/curl/register.php mode change 100644 => 100755 tests/curl/register_extend_0.php mode change 100644 => 100755 tests/curl/registerdevice_example.json mode change 100644 => 100755 tests/integration/AppTest.php diff --git a/AUTHORS.md b/AUTHORS.md old mode 100644 new mode 100755 diff --git a/CHANGELOG.md b/CHANGELOG.md old mode 100644 new mode 100755 index c4467aa..bde7110 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +#SensorLogger (0.0.4.1) +* **Enhancement**: +* Now checking for already available DataTypes to omit duplicates on device registration +* **Bugfix**: +* Fixed Bug referring to Issue #19 reported by @user17476566786 + #SensorLogger (0.0.4) * **Enhancement**: * dashboard widget (chart) diff --git a/COPYING b/COPYING old mode 100644 new mode 100755 diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/Makefile b/Makefile old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/appinfo/app.php b/appinfo/app.php old mode 100644 new mode 100755 diff --git a/appinfo/autoload.php b/appinfo/autoload.php old mode 100644 new mode 100755 diff --git a/appinfo/database.xml b/appinfo/database.xml old mode 100644 new mode 100755 diff --git a/appinfo/info.xml b/appinfo/info.xml old mode 100644 new mode 100755 index d2639d4..909ca6f --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -5,7 +5,7 @@ SensorLogger for ownCloud enables users to log data provided by sensor devices MIT Alexander Stocker - 0.0.4 + 0.0.4.1 SensorLogger tool 174814 @@ -15,3 +15,4 @@ mysql + \ No newline at end of file diff --git a/appinfo/routes.php b/appinfo/routes.php old mode 100644 new mode 100755 diff --git a/controller/apisensorloggercontroller.php b/controller/apisensorloggercontroller.php old mode 100644 new mode 100755 index 1d31d05..a9201dd --- a/controller/apisensorloggercontroller.php +++ b/controller/apisensorloggercontroller.php @@ -5,6 +5,7 @@ use OC\OCS\Exception; use OC\OCS\Result; use OC\Share\Share; +use OCA\SensorLogger\DataType; use OCA\SensorLogger\DataTypes; use OCA\SensorLogger\SensorDevices; use OCP\API; @@ -15,6 +16,7 @@ use OCP\IGroupManager; use OCP\IL10N; use OCP\IRequest; +use OCP\IUser; use OCP\IUserManager; use OCP\Share\Exceptions\ShareNotFound; use OCP\Share\IManager; @@ -36,6 +38,8 @@ class ApiSensorLoggerController extends ApiController { private $groupManager; /** @var IUserManager */ private $userManager; + /** @var IUser */ + private $currentUser; /** @var IL10N */ private $l; @@ -232,7 +236,7 @@ protected function checkRequestParams($deviceId,$params) { $deviceGroupId = $this->insertDeviceGroup($params['deviceGroup']); if(is_int($deviceGroupId)) { try { - SensorDevices::updateDevice($deviceId,'group_id',$deviceGroupId,$this->db); + SensorDevices::updateDevice($deviceId,'group_id',$deviceGroupId,$this->db); } catch (\Exception $e) {} } } @@ -246,7 +250,18 @@ protected function checkRequestParams($deviceId,$params) { } } if(isset($params['deviceDataTypes']) && is_array($params['deviceDataTypes'])) { - foreach($params['deviceDataTypes'] as $array){ + foreach($params['deviceDataTypes'] as $key => $array){ + $availableDataTypes = DataTypes::getDataTypesByUserId($this->userId,$this->db); + /** @var DataType $availableDataType */ + foreach($availableDataTypes as $availableDataType) { + if($availableDataType->getShort() === $array['unit'] && $availableDataType->getType() === $array['type']) { + $dataTypeId = $availableDataType->getId(); + if(is_int($dataTypeId)) { + $this->insertDeviceDataTypes($deviceId,$dataTypeId); + } + continue 2; + } + } $dataTypeId = $this->insertDataTypes($array); if(is_int($dataTypeId)) { $this->insertDeviceDataTypes($deviceId,$dataTypeId); @@ -418,12 +433,31 @@ public function deleteShare() { * @return bool */ protected function canAccessShare(IShare $share) { - - # TODO [GH21] Add apisensorloggercontroller::canAccessShare - + // A file with permissions 0 can't be accessed by us. So Don't show it if ($share->getPermissions() === 0) { return false; } + + // Owner of the file and the sharer of the file can always get share + if ($share->getShareOwner() === $this->currentUser->getUID() || + $share->getSharedBy() === $this->currentUser->getUID() + ) { + return true; + } + + // If the share is shared with you (or a group you are a member of) + if ($share->getShareType() === Share::SHARE_TYPE_USER && + $share->getSharedWith() === $this->currentUser->getUID()) { + return true; + } + + if ($share->getShareType() === Share::SHARE_TYPE_GROUP) { + $sharedWith = $this->groupManager->get($share->getSharedWith()); + if (!is_null($sharedWith) && $sharedWith->inGroup($this->currentUser)) { + return true; + } + } + return false; } diff --git a/controller/sensorloggercontroller.php b/controller/sensorloggercontroller.php old mode 100644 new mode 100755 diff --git a/css/jquery-editable.css b/css/jquery-editable.css old mode 100644 new mode 100755 diff --git a/css/style.css b/css/style.css old mode 100644 new mode 100755 diff --git a/img/app.svg b/img/app.svg old mode 100644 new mode 100755 diff --git a/img/clear.png b/img/clear.png old mode 100644 new mode 100755 diff --git a/img/loading.gif b/img/loading.gif old mode 100644 new mode 100755 diff --git a/img/save.svg b/img/save.svg old mode 100644 new mode 100755 diff --git a/js/app.js b/js/app.js old mode 100644 new mode 100755 diff --git a/js/deviceactions.js b/js/deviceactions.js old mode 100644 new mode 100755 diff --git a/js/jquery-editable-poshytip.min.js b/js/jquery-editable-poshytip.min.js old mode 100644 new mode 100755 diff --git a/js/jquery.jqplot.min.js b/js/jquery.jqplot.min.js old mode 100644 new mode 100755 diff --git a/js/jquery.poshytip.min.js b/js/jquery.poshytip.min.js old mode 100644 new mode 100755 diff --git a/js/navigation.js b/js/navigation.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.BezierCurveRenderer.js b/js/plugins/jqplot.BezierCurveRenderer.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.BezierCurveRenderer.min.js b/js/plugins/jqplot.BezierCurveRenderer.min.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.barRenderer.js b/js/plugins/jqplot.barRenderer.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.barRenderer.min.js b/js/plugins/jqplot.barRenderer.min.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.blockRenderer.js b/js/plugins/jqplot.blockRenderer.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.blockRenderer.min.js b/js/plugins/jqplot.blockRenderer.min.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.bubbleRenderer.js b/js/plugins/jqplot.bubbleRenderer.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.bubbleRenderer.min.js b/js/plugins/jqplot.bubbleRenderer.min.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.canvasAxisLabelRenderer.js b/js/plugins/jqplot.canvasAxisLabelRenderer.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.canvasAxisLabelRenderer.min.js b/js/plugins/jqplot.canvasAxisLabelRenderer.min.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.canvasAxisTickRenderer.js b/js/plugins/jqplot.canvasAxisTickRenderer.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.canvasAxisTickRenderer.min.js b/js/plugins/jqplot.canvasAxisTickRenderer.min.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.canvasOverlay.js b/js/plugins/jqplot.canvasOverlay.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.canvasOverlay.min.js b/js/plugins/jqplot.canvasOverlay.min.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.canvasTextRenderer.js b/js/plugins/jqplot.canvasTextRenderer.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.canvasTextRenderer.min.js b/js/plugins/jqplot.canvasTextRenderer.min.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.categoryAxisRenderer.js b/js/plugins/jqplot.categoryAxisRenderer.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.categoryAxisRenderer.min.js b/js/plugins/jqplot.categoryAxisRenderer.min.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.ciParser.js b/js/plugins/jqplot.ciParser.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.ciParser.min.js b/js/plugins/jqplot.ciParser.min.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.cursor.js b/js/plugins/jqplot.cursor.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.cursor.min.js b/js/plugins/jqplot.cursor.min.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.dateAxisRenderer.js b/js/plugins/jqplot.dateAxisRenderer.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.dateAxisRenderer.min.js b/js/plugins/jqplot.dateAxisRenderer.min.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.donutRenderer.js b/js/plugins/jqplot.donutRenderer.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.donutRenderer.min.js b/js/plugins/jqplot.donutRenderer.min.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.dragable.js b/js/plugins/jqplot.dragable.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.dragable.min.js b/js/plugins/jqplot.dragable.min.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.enhancedLegendRenderer.js b/js/plugins/jqplot.enhancedLegendRenderer.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.enhancedLegendRenderer.min.js b/js/plugins/jqplot.enhancedLegendRenderer.min.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.funnelRenderer.js b/js/plugins/jqplot.funnelRenderer.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.funnelRenderer.min.js b/js/plugins/jqplot.funnelRenderer.min.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.highlighter.js b/js/plugins/jqplot.highlighter.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.highlighter.min.js b/js/plugins/jqplot.highlighter.min.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.json2.js b/js/plugins/jqplot.json2.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.json2.min.js b/js/plugins/jqplot.json2.min.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.logAxisRenderer.js b/js/plugins/jqplot.logAxisRenderer.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.logAxisRenderer.min.js b/js/plugins/jqplot.logAxisRenderer.min.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.mekkoAxisRenderer.js b/js/plugins/jqplot.mekkoAxisRenderer.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.mekkoAxisRenderer.min.js b/js/plugins/jqplot.mekkoAxisRenderer.min.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.mekkoRenderer.js b/js/plugins/jqplot.mekkoRenderer.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.mekkoRenderer.min.js b/js/plugins/jqplot.mekkoRenderer.min.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.meterGaugeRenderer.js b/js/plugins/jqplot.meterGaugeRenderer.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.meterGaugeRenderer.min.js b/js/plugins/jqplot.meterGaugeRenderer.min.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.mobile.js b/js/plugins/jqplot.mobile.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.mobile.min.js b/js/plugins/jqplot.mobile.min.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.ohlcRenderer.js b/js/plugins/jqplot.ohlcRenderer.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.ohlcRenderer.min.js b/js/plugins/jqplot.ohlcRenderer.min.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.pieRenderer.js b/js/plugins/jqplot.pieRenderer.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.pieRenderer.min.js b/js/plugins/jqplot.pieRenderer.min.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.pointLabels.js b/js/plugins/jqplot.pointLabels.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.pointLabels.min.js b/js/plugins/jqplot.pointLabels.min.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.pyramidAxisRenderer.js b/js/plugins/jqplot.pyramidAxisRenderer.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.pyramidAxisRenderer.min.js b/js/plugins/jqplot.pyramidAxisRenderer.min.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.pyramidGridRenderer.js b/js/plugins/jqplot.pyramidGridRenderer.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.pyramidGridRenderer.min.js b/js/plugins/jqplot.pyramidGridRenderer.min.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.pyramidRenderer.js b/js/plugins/jqplot.pyramidRenderer.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.pyramidRenderer.min.js b/js/plugins/jqplot.pyramidRenderer.min.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.trendline.js b/js/plugins/jqplot.trendline.js old mode 100644 new mode 100755 diff --git a/js/plugins/jqplot.trendline.min.js b/js/plugins/jqplot.trendline.min.js old mode 100644 new mode 100755 diff --git a/js/script.js b/js/script.js old mode 100644 new mode 100755 diff --git a/js/utils.js b/js/utils.js old mode 100644 new mode 100755 diff --git a/lib/App.php b/lib/App.php old mode 100644 new mode 100755 diff --git a/lib/DataType.php b/lib/DataType.php old mode 100644 new mode 100755 diff --git a/lib/DataTypes.php b/lib/DataTypes.php old mode 100644 new mode 100755 index 660ac02..de872a6 --- a/lib/DataTypes.php +++ b/lib/DataTypes.php @@ -50,6 +50,33 @@ public static function getDataTypeById($userId, $dataTypeId, IDBConnection $db) return $data; } + /** + * @param $userId + * @param IDBConnection $db + * @return array + */ + public static function getDataTypesByUserId($userId, IDBConnection $db) { + $query = $db->getQueryBuilder(); + $query->select('*') + ->from('sensorlogger_data_types') + ->where('user_id = "'.$userId.'"'); + $results = $query->execute(); + + $data = []; + + foreach($results->fetchAll() as $result) { + $data[] = DataType::fromRow($result); + } + + return $data; + } + + /** + * @param $userId + * @param $deviceId + * @param IDBConnection $db + * @return array + */ public static function getDeviceDataTypesByDeviceId($userId, $deviceId, IDBConnection $db) { $query = $db->getQueryBuilder(); $query->select(array('sdt.id','sdt.description','sdt.type','sdt.short','sdt.type')) diff --git a/lib/Device.php b/lib/Device.php old mode 100644 new mode 100755 diff --git a/lib/DeviceTypes.php b/lib/DeviceTypes.php old mode 100644 new mode 100755 diff --git a/lib/Group.php b/lib/Group.php old mode 100644 new mode 100755 diff --git a/lib/Log.php b/lib/Log.php old mode 100644 new mode 100755 diff --git a/lib/LogExtended.php b/lib/LogExtended.php old mode 100644 new mode 100755 diff --git a/lib/SensorDevices.php b/lib/SensorDevices.php old mode 100644 new mode 100755 diff --git a/lib/SensorGroups.php b/lib/SensorGroups.php old mode 100644 new mode 100755 diff --git a/lib/SensorLogs.php b/lib/SensorLogs.php old mode 100644 new mode 100755 diff --git a/lib/Type.php b/lib/Type.php old mode 100644 new mode 100755 diff --git a/lib/Widget.php b/lib/Widget.php old mode 100644 new mode 100755 diff --git a/lib/Widgets.php b/lib/Widgets.php old mode 100644 new mode 100755 diff --git a/phpunit.integration.xml b/phpunit.integration.xml old mode 100644 new mode 100755 diff --git a/phpunit.xml b/phpunit.xml old mode 100644 new mode 100755 diff --git a/templates/main.php b/templates/main.php old mode 100644 new mode 100755 diff --git a/templates/part.chart.php b/templates/part.chart.php old mode 100644 new mode 100755 diff --git a/templates/part.dashboard.php b/templates/part.dashboard.php old mode 100644 new mode 100755 diff --git a/templates/part.list.php b/templates/part.list.php old mode 100644 new mode 100755 diff --git a/templates/part.listDataTypes.php b/templates/part.listDataTypes.php old mode 100644 new mode 100755 diff --git a/templates/part.listDeviceGroups.php b/templates/part.listDeviceGroups.php old mode 100644 new mode 100755 diff --git a/templates/part.listDeviceTypes.php b/templates/part.listDeviceTypes.php old mode 100644 new mode 100755 diff --git a/templates/part.listDevices.php b/templates/part.listDevices.php old mode 100644 new mode 100755 diff --git a/templates/part.listSharedDevices.php b/templates/part.listSharedDevices.php old mode 100644 new mode 100755 diff --git a/templates/part.navigation.php b/templates/part.navigation.php old mode 100644 new mode 100755 diff --git a/templates/part.settings.php b/templates/part.settings.php old mode 100644 new mode 100755 diff --git a/templates/widget_dashboard.php b/templates/widget_dashboard.php old mode 100644 new mode 100755 diff --git a/tests/bootstrap.php b/tests/bootstrap.php old mode 100644 new mode 100755 diff --git a/tests/curl/createlog_example.json b/tests/curl/createlog_example.json old mode 100644 new mode 100755 diff --git a/tests/curl/createlog_extend_example.json b/tests/curl/createlog_extend_example.json old mode 100644 new mode 100755 diff --git a/tests/curl/datatyperesponse.json b/tests/curl/datatyperesponse.json old mode 100644 new mode 100755 diff --git a/tests/curl/getdatatypes.php b/tests/curl/getdatatypes.php old mode 100644 new mode 100755 diff --git a/tests/curl/post.php b/tests/curl/post.php old mode 100644 new mode 100755 diff --git a/tests/curl/post_extend.php b/tests/curl/post_extend.php old mode 100644 new mode 100755 diff --git a/tests/curl/post_extend_0.php b/tests/curl/post_extend_0.php old mode 100644 new mode 100755 diff --git a/tests/curl/put.php b/tests/curl/put.php old mode 100644 new mode 100755 diff --git a/tests/curl/register.php b/tests/curl/register.php old mode 100644 new mode 100755 diff --git a/tests/curl/register_extend_0.php b/tests/curl/register_extend_0.php old mode 100644 new mode 100755 diff --git a/tests/curl/registerdevice_example.json b/tests/curl/registerdevice_example.json old mode 100644 new mode 100755 diff --git a/tests/integration/AppTest.php b/tests/integration/AppTest.php old mode 100644 new mode 100755