diff options
-rw-r--r-- | apps/encryption/lib/crypto/encryptall.php | 6 | ||||
-rw-r--r-- | apps/user_ldap/js/wizard/wizardTabLoginFilter.js | 13 | ||||
-rw-r--r-- | apps/user_ldap/templates/part.wizard-loginfilter.php | 2 | ||||
-rw-r--r-- | core/js/shareitemmodel.js | 2 | ||||
-rw-r--r-- | core/js/tests/specs/shareitemmodelSpec.js | 8 | ||||
-rw-r--r-- | lib/private/connector/sabre/listenerplugin.php | 12 | ||||
-rw-r--r-- | lib/public/sabrepluginevent.php | 82 | ||||
-rw-r--r-- | lib/public/sabrepluginexception.php | 41 |
8 files changed, 158 insertions, 8 deletions
diff --git a/apps/encryption/lib/crypto/encryptall.php b/apps/encryption/lib/crypto/encryptall.php index a0c69c13fdd..8e97fe341b4 100644 --- a/apps/encryption/lib/crypto/encryptall.php +++ b/apps/encryption/lib/crypto/encryptall.php @@ -280,6 +280,12 @@ class EncryptAll { $newPasswords[] = [$uid, $password]; } } + + if (empty($newPasswords)) { + $this->output->writeln("\nAll users already had a key-pair, no further action needed.\n"); + return; + } + $table->setRows($newPasswords); $table->render(); diff --git a/apps/user_ldap/js/wizard/wizardTabLoginFilter.js b/apps/user_ldap/js/wizard/wizardTabLoginFilter.js index b73d267d168..0316db5b61c 100644 --- a/apps/user_ldap/js/wizard/wizardTabLoginFilter.js +++ b/apps/user_ldap/js/wizard/wizardTabLoginFilter.js @@ -71,7 +71,8 @@ OCA = OCA || {}; ], 'ldap_login_filter_mode' ); - _.bindAll(this, 'onVerifyClick'); + _.bindAll(this, 'onVerifyClick', 'onTestLoginnameChange'); + this.managedItems.ldap_test_loginname.$element.keyup(this.onTestLoginnameChange); this.managedItems.ldap_test_loginname.$relatedElements.click(this.onVerifyClick); }, @@ -231,6 +232,16 @@ OCA = OCA || {}; } else { this.configModel.requestWizard('ldap_test_loginname', {ldap_test_loginname: testLogin}); } + }, + + /** + * enables/disables the "Verify Settings" button, depending whether + * the corresponding text input has a value or not + */ + onTestLoginnameChange: function() { + var loginName = this.managedItems.ldap_test_loginname.$element.val(); + var beDisabled = !_.isString(loginName) || !loginName.trim(); + this.managedItems.ldap_test_loginname.$relatedElements.prop('disabled', beDisabled); } }); diff --git a/apps/user_ldap/templates/part.wizard-loginfilter.php b/apps/user_ldap/templates/part.wizard-loginfilter.php index 8d9fccf24b8..a13931d9327 100644 --- a/apps/user_ldap/templates/part.wizard-loginfilter.php +++ b/apps/user_ldap/templates/part.wizard-loginfilter.php @@ -52,7 +52,7 @@ placeholder="<?php p($l->t('Test Loginname'));?>" class="ldapVerifyInput" title="Attempts to receive a DN for the given loginname and the current login filter"/> - <button class="ldapVerifyLoginName" name="ldapTestLoginSettings" type="button"> + <button class="ldapVerifyLoginName" name="ldapTestLoginSettings" type="button" disabled="disabled"> <?php p($l->t('Verify settings'));?> </button> </p> diff --git a/core/js/shareitemmodel.js b/core/js/shareitemmodel.js index d883497433f..db80a9aa76f 100644 --- a/core/js/shareitemmodel.js +++ b/core/js/shareitemmodel.js @@ -69,7 +69,7 @@ */ var SHARE_RESPONSE_INT_PROPS = [ 'id', 'file_parent', 'mail_send', 'file_source', 'item_source', 'permissions', - 'storage', 'share_type', 'parent', 'stime', 'expiration' + 'storage', 'share_type', 'parent', 'stime' ]; /** diff --git a/core/js/tests/specs/shareitemmodelSpec.js b/core/js/tests/specs/shareitemmodelSpec.js index 07a6fbdc23f..a2f3d6fa0ad 100644 --- a/core/js/tests/specs/shareitemmodelSpec.js +++ b/core/js/tests/specs/shareitemmodelSpec.js @@ -169,7 +169,7 @@ describe('OC.Share.ShareItemModel', function() { /* jshint camelcase: false */ shares: [{ displayname_owner: 'root', - expiration: 1111, + expiration: '2015-10-12 00:00:00', file_source: 123, file_target: '/folder', id: 20, @@ -187,7 +187,7 @@ describe('OC.Share.ShareItemModel', function() { uid_owner: 'root' }, { displayname_owner: 'root', - expiration: 2222, + expiration: '2015-10-15 00:00:00', file_source: 456, file_target: '/file_in_folder.txt', id: 21, @@ -263,7 +263,7 @@ describe('OC.Share.ShareItemModel', function() { reshare: {}, shares: [{ displayname_owner: 'root', - expiration: '1403900000', + expiration: '2015-10-12 00:00:00', file_source: '123', file_target: '/folder', id: '20', @@ -301,7 +301,7 @@ describe('OC.Share.ShareItemModel', function() { expect(share.share_type).toEqual(OC.Share.SHARE_TYPE_USER); expect(share.share_with).toEqual('user1'); expect(share.stime).toEqual(1403884258); - expect(share.expiration).toEqual(1403900000); + expect(share.expiration).toEqual('2015-10-12 00:00:00'); }); }); diff --git a/lib/private/connector/sabre/listenerplugin.php b/lib/private/connector/sabre/listenerplugin.php index d0d40f4dc86..ec628add28b 100644 --- a/lib/private/connector/sabre/listenerplugin.php +++ b/lib/private/connector/sabre/listenerplugin.php @@ -21,6 +21,9 @@ namespace OC\Connector\Sabre; +use OCP\AppFramework\Http; +use OCP\SabrePluginEvent; +use OCP\SabrePluginException; use Sabre\DAV\ServerPlugin; use Symfony\Component\EventDispatcher\EventDispatcherInterface; @@ -49,9 +52,16 @@ class ListenerPlugin extends ServerPlugin { * in case the system is in maintenance mode. * * @return bool + * @throws \Exception */ public function emitListener() { - $this->dispatcher->dispatch('OC\Connector\Sabre::beforeMethod'); + $event = new SabrePluginEvent(); + + $this->dispatcher->dispatch('OC\Connector\Sabre::beforeMethod', $event); + + if ($event->getStatusCode() !== Http::STATUS_OK) { + throw new SabrePluginException($event->getMessage(), $event->getStatusCode()); + } return true; } diff --git a/lib/public/sabrepluginevent.php b/lib/public/sabrepluginevent.php new file mode 100644 index 00000000000..fed3237166d --- /dev/null +++ b/lib/public/sabrepluginevent.php @@ -0,0 +1,82 @@ +<?php +/** + * @author Joas Schilling <nickvergessen@owncloud.com> + * + * @copyright Copyright (c) 2015, ownCloud, Inc. + * @license AGPL-3.0 + * + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * 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, version 3, + * along with this program. If not, see <http://www.gnu.org/licenses/> + * + */ + +namespace OCP; + + +use OCP\AppFramework\Http; +use Symfony\Component\EventDispatcher\Event; + +/** + * @since 8.2.0 + */ +class SabrePluginEvent extends Event { + + /** @var int */ + protected $statusCode; + + /** @var string */ + protected $message; + + /** + * @since 8.2.0 + */ + public function __construct() { + $this->message = ''; + $this->statusCode = Http::STATUS_OK; + } + + /** + * @param int $statusCode + * @return self + * @since 8.2.0 + */ + public function setStatusCode($statusCode) { + $this->statusCode = (int) $statusCode; + return $this; + } + + /** + * @param string $message + * @return self + * @since 8.2.0 + */ + public function setMessage($message) { + $this->message = (string) $message; + return $this; + } + + /** + * @return int + * @since 8.2.0 + */ + public function getStatusCode() { + return $this->statusCode; + } + + /** + * @return string + * @since 8.2.0 + */ + public function getMessage() { + return $this->message; + } +} diff --git a/lib/public/sabrepluginexception.php b/lib/public/sabrepluginexception.php new file mode 100644 index 00000000000..5dba3b90a02 --- /dev/null +++ b/lib/public/sabrepluginexception.php @@ -0,0 +1,41 @@ +<?php +/** + * @author Joas Schilling <nickvergessen@owncloud.com> + * + * @copyright Copyright (c) 2015, ownCloud, Inc. + * @license AGPL-3.0 + * + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * 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, version 3, + * along with this program. If not, see <http://www.gnu.org/licenses/> + * + */ + +namespace OCP; + + +use Sabre\DAV\Exception; + +/** + * @since 8.2.0 + */ +class SabrePluginException extends Exception { + + /** + * Returns the HTTP statuscode for this exception + * + * @return int + * @since 8.2.0 + */ + public function getHTTPCode() { + return $this->code; + } +} |