diff options
author | Robin Appelman <icewind@owncloud.com> | 2016-08-03 15:57:06 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2016-11-16 15:24:27 +0100 |
commit | 1afccde16a04f9a91f9c5c46090517a54670f34d (patch) | |
tree | 400495cbb0f40c7054b5fc63539d3546aac1975b /settings/js/authtoken_view.js | |
parent | b4e27d35f59e359eb7591a15c7f037968081eb1b (diff) | |
download | nextcloud-server-1afccde16a04f9a91f9c5c46090517a54670f34d.tar.gz nextcloud-server-1afccde16a04f9a91f9c5c46090517a54670f34d.zip |
allow configuring filesystem access
Signed-off-by: Robin Appelman <icewind@owncloud.com>
Diffstat (limited to 'settings/js/authtoken_view.js')
-rw-r--r-- | settings/js/authtoken_view.js | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/settings/js/authtoken_view.js b/settings/js/authtoken_view.js index 361b5dcc7a8..54561ffd1e3 100644 --- a/settings/js/authtoken_view.js +++ b/settings/js/authtoken_view.js @@ -27,7 +27,13 @@ var TEMPLATE_TOKEN = '<tr data-id="{{id}}">' - + '<td class="has-tooltip" title="{{title}}"><span class="token-name">{{name}}</span></td>' + + '<td class="has-tooltip" title="{{title}}">' + + '<span class="token-name">{{name}}</span>' + + '<div class="configure">' + + '<input class="filesystem checkbox" type="checkbox" id="{{id}}_filesystem" {{#if scope.filesystem}}checked{{/if}}/>' + + '<label for="{{id}}_filesystem">' + t('core', 'Allow filesystem access') + '</label><br/>' + + '</div>' + + '</td>' + '<td><span class="last-activity has-tooltip" title="{{lastActivityTime}}">{{lastActivity}}</span></td>' + '<td class="icon">' + '{{#if canScope}}' @@ -211,6 +217,8 @@ var $el = $(el); $el.on('click', 'a.icon-delete', _.bind(_this._onDeleteToken, _this)); + $el.on('click', 'a.icon-settings', _.bind(_this._onConfigureToken, _this)); + $el.on('change', 'input.filesystem', _.bind(_this._onSetTokenScope, _this)); }); this._form = $('#app-password-form'); @@ -332,6 +340,13 @@ this._addAppPasswordBtn.toggleClass('icon-loading-small', state); }, + _onConfigureToken: function (event) { + var $target = $(event.target); + var $row = $target.closest('tr'); + $row.toggleClass('active'); + var id = $row.data('id'); + }, + _onDeleteToken: function (event) { var $target = $(event.target); var $row = $target.closest('tr'); @@ -360,6 +375,24 @@ }); }, + _onSetTokenScope: function (event) { + var $target = $(event.target); + var $row = $target.closest('tr'); + var id = $row.data('id'); + + var token = this.collection.get(id); + if (_.isUndefined(token)) { + // Ignore event + return; + } + + var scope = token.get('scope'); + scope.filesystem = $target.is(":checked"); + + token.set('scope', scope); + token.save(); + }, + _toggleFormResult: function (showForm) { if (showForm) { this._result.slideUp(); |