From 1afccde16a04f9a91f9c5c46090517a54670f34d Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 3 Aug 2016 15:57:06 +0200 Subject: allow configuring filesystem access Signed-off-by: Robin Appelman --- settings/js/authtoken_view.js | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'settings/js') 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 = '' - + '{{name}}' + + '' + + '{{name}}' + + '
' + + '' + + '
' + + '
' + + '' + '{{lastActivity}}' + '' + '{{#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(); -- cgit v1.2.3