diff options
-rw-r--r-- | apps/systemtags/appinfo/info.xml | 2 | ||||
-rw-r--r-- | apps/systemtags/lib/Settings/Admin.php | 2 | ||||
-rw-r--r-- | apps/systemtags/tests/Settings/AdminTest.php | 2 | ||||
-rw-r--r-- | apps/workflowengine/lib/Manager.php | 48 | ||||
-rw-r--r-- | core/js/shareconfigmodel.js | 2 | ||||
-rw-r--r-- | core/js/sharedialogexpirationview.js | 4 | ||||
-rw-r--r-- | core/js/sharedialoglinkshareview.js | 8 | ||||
-rw-r--r-- | core/js/sharedialogmailview.js | 4 | ||||
-rw-r--r-- | core/js/sharedialogresharerinfoview.js | 2 | ||||
-rw-r--r-- | core/js/sharedialogshareelistview.js | 4 | ||||
-rw-r--r-- | core/js/sharedialogview.js | 6 | ||||
-rw-r--r-- | lib/composer/composer/autoload_classmap.php | 1 | ||||
-rw-r--r-- | lib/composer/composer/autoload_static.php | 1 | ||||
-rw-r--r-- | lib/public/WorkflowEngine/IOperation.php | 39 |
14 files changed, 106 insertions, 19 deletions
diff --git a/apps/systemtags/appinfo/info.xml b/apps/systemtags/appinfo/info.xml index 46bb9278838..15b9abed0d4 100644 --- a/apps/systemtags/appinfo/info.xml +++ b/apps/systemtags/appinfo/info.xml @@ -7,7 +7,7 @@ <licence>AGPL</licence> <author>Vincent Petry, Joas Schilling</author> <default_enable/> - <version>1.1.1</version> + <version>1.1.2</version> <dependencies> <owncloud min-version="9.2" max-version="9.2" /> </dependencies> diff --git a/apps/systemtags/lib/Settings/Admin.php b/apps/systemtags/lib/Settings/Admin.php index fbdec8741f7..c8d986414e6 100644 --- a/apps/systemtags/lib/Settings/Admin.php +++ b/apps/systemtags/lib/Settings/Admin.php @@ -39,7 +39,7 @@ class Admin implements ISettings { * @return string the section ID, e.g. 'sharing' */ public function getSection() { - return 'sharing'; + return 'additional'; } /** diff --git a/apps/systemtags/tests/Settings/AdminTest.php b/apps/systemtags/tests/Settings/AdminTest.php index b1faf82cf25..174fd382159 100644 --- a/apps/systemtags/tests/Settings/AdminTest.php +++ b/apps/systemtags/tests/Settings/AdminTest.php @@ -43,7 +43,7 @@ class AdminTest extends TestCase { } public function testGetSection() { - $this->assertSame('sharing', $this->admin->getSection()); + $this->assertSame('additional', $this->admin->getSection()); } public function testGetPriority() { diff --git a/apps/workflowengine/lib/Manager.php b/apps/workflowengine/lib/Manager.php index b72836a919c..9140ef73ea7 100644 --- a/apps/workflowengine/lib/Manager.php +++ b/apps/workflowengine/lib/Manager.php @@ -30,6 +30,7 @@ use OCP\IL10N; use OCP\IServerContainer; use OCP\WorkflowEngine\ICheck; use OCP\WorkflowEngine\IManager; +use OCP\WorkflowEngine\IOperation; class Manager implements IManager { @@ -176,6 +177,8 @@ class Manager implements IManager { * @throws \UnexpectedValueException */ public function addOperation($class, $name, array $checks, $operation) { + $this->validateOperation($class, $name, $checks, $operation); + $checkIds = []; foreach ($checks as $check) { $checkIds[] = $this->addCheck($check['class'], $check['operator'], $check['value']); @@ -204,6 +207,9 @@ class Manager implements IManager { * @throws \UnexpectedValueException */ public function updateOperation($id, $name, array $checks, $operation) { + $row = $this->getOperation($id); + $this->validateOperation($row['class'], $name, $checks, $operation); + $checkIds = []; foreach ($checks as $check) { $checkIds[] = $this->addCheck($check['class'], $check['operator'], $check['value']); @@ -233,6 +239,43 @@ class Manager implements IManager { } /** + * @param string $class + * @param string $name + * @param array[] $checks + * @param string $operation + * @throws \UnexpectedValueException + */ + protected function validateOperation($class, $name, array $checks, $operation) { + try { + /** @var IOperation $instance */ + $instance = $this->container->query($class); + } catch (QueryException $e) { + throw new \UnexpectedValueException($this->l->t('Operation %s does not exist', $class)); + } + + if (!($instance instanceof IOperation)) { + throw new \UnexpectedValueException($this->l->t('Operation %s is invalid', $class)); + } + + $instance->validateOperation($name, $checks, $operation); + + foreach ($checks as $check) { + try { + /** @var ICheck $instance */ + $instance = $this->container->query($check['class']); + } catch (QueryException $e) { + throw new \UnexpectedValueException($this->l->t('Check %s does not exist', $class)); + } + + if (!($instance instanceof ICheck)) { + throw new \UnexpectedValueException($this->l->t('Check %s is invalid', $class)); + } + + $instance->validateCheck($check['operator'], $check['value']); + } + } + + /** * @param int[] $checkIds * @return array[] */ @@ -279,13 +322,8 @@ class Manager implements IManager { * @param string $operator * @param string $value * @return int Check unique ID - * @throws \UnexpectedValueException */ protected function addCheck($class, $operator, $value) { - /** @var ICheck $check */ - $check = $this->container->query($class); - $check->validateCheck($operator, $value); - $hash = md5($class . '::' . $operator . '::' . $value); $query = $this->connection->getQueryBuilder(); diff --git a/core/js/shareconfigmodel.js b/core/js/shareconfigmodel.js index b1bbde7a695..b04c2acae16 100644 --- a/core/js/shareconfigmodel.js +++ b/core/js/shareconfigmodel.js @@ -8,7 +8,7 @@ * */ -/* global moment */ +/* global moment, oc_appconfig, oc_config */ (function() { if (!OC.Share) { diff --git a/core/js/sharedialogexpirationview.js b/core/js/sharedialogexpirationview.js index d1b326a56bc..a9849ef9161 100644 --- a/core/js/sharedialogexpirationview.js +++ b/core/js/sharedialogexpirationview.js @@ -8,7 +8,7 @@ * */ -/* global moment */ +/* global moment, Handlebars */ (function() { if (!OC.Share) { @@ -107,7 +107,7 @@ $target.tooltip('hide'); $target.removeClass('error'); - expiration = moment($target.val(), 'DD-MM-YYYY').format('YYYY-MM-DD'); + var expiration = moment($target.val(), 'DD-MM-YYYY').format('YYYY-MM-DD'); this.model.get('linkShare').expiration = expiration; this.model.saveLinkShare({ expiration: expiration diff --git a/core/js/sharedialoglinkshareview.js b/core/js/sharedialoglinkshareview.js index 8ad2e270099..83bf7979000 100644 --- a/core/js/sharedialoglinkshareview.js +++ b/core/js/sharedialoglinkshareview.js @@ -8,6 +8,8 @@ * */ +/* globals Clipboard, Handlebars */ + (function() { if (!OC.Share) { OC.Share = {}; @@ -131,7 +133,7 @@ var clipboard = new Clipboard('.clipboardButton'); clipboard.on('success', function(e) { - $input = $(e.trigger); + var $input = $(e.trigger); $input.tooltip({placement: 'bottom', trigger: 'manual', title: t('core', 'Copied!')}); $input.tooltip('show'); _.delay(function() { @@ -139,7 +141,7 @@ }, 3000); }); clipboard.on('error', function (e) { - $input = $(e.trigger); + var $input = $(e.trigger); var actionMsg = ''; if (/iPhone|iPad/i.test(navigator.userAgent)) { actionMsg = t('core', 'Not supported!'); @@ -206,7 +208,7 @@ }, onPasswordKeyUp: function(event) { - if(event.keyCode == 13) { + if(event.keyCode === 13) { this.onPasswordEntered(); } }, diff --git a/core/js/sharedialogmailview.js b/core/js/sharedialogmailview.js index 04baaee2173..ce0893cb25c 100644 --- a/core/js/sharedialogmailview.js +++ b/core/js/sharedialogmailview.js @@ -8,6 +8,8 @@ * */ +/* globals escapeHTML, Handlebars */ + (function() { if (!OC.Share) { OC.Share = {}; @@ -137,7 +139,7 @@ fetch: 'getShareWithEmail', search: search.term }, function(result) { - if (result.status == 'success' && result.data.length > 0) { + if (result.status === 'success' && result.data.length > 0) { response(result.data); } }); diff --git a/core/js/sharedialogresharerinfoview.js b/core/js/sharedialogresharerinfoview.js index 600e2ecbf56..654eebf4997 100644 --- a/core/js/sharedialogresharerinfoview.js +++ b/core/js/sharedialogresharerinfoview.js @@ -8,6 +8,8 @@ * */ +/* globals Handlebars */ + (function() { if (!OC.Share) { OC.Share = {}; diff --git a/core/js/sharedialogshareelistview.js b/core/js/sharedialogshareelistview.js index d156d30cecd..540bafa5c1c 100644 --- a/core/js/sharedialogshareelistview.js +++ b/core/js/sharedialogshareelistview.js @@ -8,6 +8,8 @@ * */ +/* globals Handlebars */ + (function() { if (!OC.Share) { OC.Share = {}; @@ -254,8 +256,6 @@ var $element = $(event.target); var $li = $element.closest('li'); var shareId = $li.data('share-id'); - var shareType = $li.data('share-type'); - var shareWith = $li.attr('data-share-with'); // adjust checkbox states var $checkboxes = $('.permissions', $li).not('input[name="edit"]').not('input[name="share"]'); diff --git a/core/js/sharedialogview.js b/core/js/sharedialogview.js index 5637ffc3a0a..2c60f216ef9 100644 --- a/core/js/sharedialogview.js +++ b/core/js/sharedialogview.js @@ -8,6 +8,8 @@ * */ +/* globals Handlebars */ + (function() { if(!OC.Share) { OC.Share = {}; @@ -148,7 +150,7 @@ function (result) { $loading.addClass('hidden'); $loading.removeClass('inlineblock'); - if (result.ocs.meta.statuscode == 100) { + if (result.ocs.meta.statuscode === 100) { var users = result.ocs.data.exact.users.concat(result.ocs.data.users); var groups = result.ocs.data.exact.groups.concat(result.ocs.data.groups); var remotes = result.ocs.data.exact.remotes.concat(result.ocs.data.remotes); @@ -404,7 +406,7 @@ if (this.configModel.get('isRemoteShareAllowed')) { sharePlaceholder = t('core', 'Share with users, groups or remote users…'); } else { - sharePlaceholder = t('core', 'Share with users or groups…') + sharePlaceholder = t('core', 'Share with users or groups…'); } } else if (this.configModel.get('isRemoteShareAllowed')) { sharePlaceholder = t('core', 'Share with users or remote users…'); diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php index 7788ee80ee4..de9da7dc5a7 100644 --- a/lib/composer/composer/autoload_classmap.php +++ b/lib/composer/composer/autoload_classmap.php @@ -237,6 +237,7 @@ return array( 'OCP\\Util' => $baseDir . '/lib/public/Util.php', 'OCP\\WorkflowEngine\\ICheck' => $baseDir . '/lib/public/WorkflowEngine/ICheck.php', 'OCP\\WorkflowEngine\\IManager' => $baseDir . '/lib/public/WorkflowEngine/IManager.php', + 'OCP\\WorkflowEngine\\IOperation' => $baseDir . '/lib/public/WorkflowEngine/IOperation.php', 'OC\\Activity\\Event' => $baseDir . '/lib/private/Activity/Event.php', 'OC\\Activity\\Manager' => $baseDir . '/lib/private/Activity/Manager.php', 'OC\\AllConfig' => $baseDir . '/lib/private/AllConfig.php', diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php index 7b7e3ac609d..45ac5e35e36 100644 --- a/lib/composer/composer/autoload_static.php +++ b/lib/composer/composer/autoload_static.php @@ -267,6 +267,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c 'OCP\\Util' => __DIR__ . '/../../..' . '/lib/public/Util.php', 'OCP\\WorkflowEngine\\ICheck' => __DIR__ . '/../../..' . '/lib/public/WorkflowEngine/ICheck.php', 'OCP\\WorkflowEngine\\IManager' => __DIR__ . '/../../..' . '/lib/public/WorkflowEngine/IManager.php', + 'OCP\\WorkflowEngine\\IOperation' => __DIR__ . '/../../..' . '/lib/public/WorkflowEngine/IOperation.php', 'OC\\Activity\\Event' => __DIR__ . '/../../..' . '/lib/private/Activity/Event.php', 'OC\\Activity\\Manager' => __DIR__ . '/../../..' . '/lib/private/Activity/Manager.php', 'OC\\AllConfig' => __DIR__ . '/../../..' . '/lib/private/AllConfig.php', diff --git a/lib/public/WorkflowEngine/IOperation.php b/lib/public/WorkflowEngine/IOperation.php new file mode 100644 index 00000000000..c75e5d940c5 --- /dev/null +++ b/lib/public/WorkflowEngine/IOperation.php @@ -0,0 +1,39 @@ +<?php +/** + * @copyright Copyright (c) 2016 Joas Schilling <coding@schilljs.com> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OCP\WorkflowEngine; + +/** + * Interface IOperation + * + * @package OCP\WorkflowEngine + * @since 9.1 + */ +interface IOperation { + /** + * @param string $name + * @param array[] $checks + * @param string $operation + * @throws \UnexpectedValueException + * @since 9.1 + */ + public function validateOperation($name, array $checks, $operation); +} |