From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 41CAB1FF16B for ; Thu, 31 Oct 2024 14:46:51 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 0077CAC59; Thu, 31 Oct 2024 14:46:44 +0100 (CET) From: Daniel Kral To: pve-devel@lists.proxmox.com Date: Thu, 31 Oct 2024 14:46:27 +0100 Message-Id: <20241031134629.144893-2-d.kral@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241031134629.144893-1-d.kral@proxmox.com> References: <20241031134629.144893-1-d.kral@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.002 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [result.data, r.id] Subject: [pve-devel] [PATCH manager 2/4] ui: api token: remove unused fixed user property X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" In earlier versions of the Proxmox VE WebGUI, a separate TokenView window could be created from a submenu item in the user's menu in the Workspace toolbar at the top. This submenu item was dropped in the commit `2ac41a189a7b6853013d1b07bb9788612620ff29` (ui: drop login-user fixed token edit due to multi window/z-index issues). This change removes the unused TokenView window component with all unused references to the `fixedUser` property, which is always unused as the only provider for this property was the TokenView window component. Signed-off-by: Daniel Kral --- Please correct me if I'm missing something here, but I couldn't find a usage of the TokenView window or fixedUser property anywhere else and I assumed that it won't be needed in the future anymore. This will make the fix for #5722 clearer to implement. www/manager6/dc/TokenEdit.js | 3 +- www/manager6/dc/TokenView.js | 62 ------------------------------------ 2 files changed, 1 insertion(+), 64 deletions(-) diff --git a/www/manager6/dc/TokenEdit.js b/www/manager6/dc/TokenEdit.js index 3b25c739..d1c8300a 100644 --- a/www/manager6/dc/TokenEdit.js +++ b/www/manager6/dc/TokenEdit.js @@ -8,7 +8,6 @@ Ext.define('PVE.dc.TokenEdit', { isAdd: true, isCreate: false, - fixedUser: false, method: 'POST', url: '/api2/extjs/access/users/', @@ -33,7 +32,7 @@ Ext.define('PVE.dc.TokenEdit', { { xtype: 'pmxDisplayEditField', cbind: { - editable: (get) => get('isCreate') && !get('fixedUser'), + editable: '{isCreate}', }, submitValue: true, editConfig: { diff --git a/www/manager6/dc/TokenView.js b/www/manager6/dc/TokenView.js index eb910feb..7d6d4274 100644 --- a/www/manager6/dc/TokenView.js +++ b/www/manager6/dc/TokenView.js @@ -7,9 +7,6 @@ Ext.define('PVE.dc.TokenView', { stateful: true, stateId: 'grid-tokens', - // use fixed user - fixedUser: undefined, - initComponent: function() { let me = this; @@ -22,34 +19,6 @@ Ext.define('PVE.dc.TokenView', { }); let reload = function() { - if (me.fixedUser) { - Proxmox.Utils.API2Request({ - url: `/access/users/${encodeURIComponent(me.fixedUser)}/token`, - method: 'GET', - failure: function(response, opts) { - Proxmox.Utils.setErrorMask(me, response.htmlStatus); - me.load_task.delay(me.load_delay); - }, - success: function(response, opts) { - Proxmox.Utils.setErrorMask(me, false); - let result = Ext.decode(response.responseText); - let data = result.data || []; - let records = []; - Ext.Array.each(data, function(token) { - let r = {}; - r.id = me.fixedUser + '!' + token.tokenid; - r.userid = me.fixedUser; - r.tokenid = token.tokenid; - r.comment = token.comment; - r.expire = token.expire; - r.privsep = token.privsep === 1; - records.push(r); - }); - store.loadData(records); - }, - }); - return; - } Proxmox.Utils.API2Request({ url: '/access/users/?full=1', method: 'GET', @@ -108,13 +77,8 @@ Ext.define('PVE.dc.TokenView', { disabled: !caps.access['User.Modify'], handler: function(btn, e) { let data = {}; - if (me.fixedUser) { - data.userid = me.fixedUser; - data.fixedUser = true; - } let win = Ext.create('PVE.dc.TokenEdit', { isCreate: true, - fixedUser: me.fixedUser, }); win.setValues(data); win.on('destroy', reload); @@ -168,7 +132,6 @@ Ext.define('PVE.dc.TokenView', { let realm = Ext.String.htmlEncode(uid.substr(realmIndex)); return `${user} ${realm}`; }, - hidden: !!me.fixedUser, flex: 2, }, { @@ -204,31 +167,6 @@ Ext.define('PVE.dc.TokenView', { }, }); - if (me.fixedUser) { - reload(); - } - me.callParent(); }, }); - -Ext.define('PVE.window.TokenView', { - extend: 'Ext.window.Window', - mixins: ['Proxmox.Mixin.CBind'], - - modal: true, - subject: gettext('API Tokens'), - scrollable: true, - layout: 'fit', - width: 800, - height: 400, - cbind: { - title: gettext('API Tokens') + ' - {userid}', - }, - items: [{ - xtype: 'pveTokenView', - cbind: { - fixedUser: '{userid}', - }, - }], -}); -- 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel