[pve-devel] [PATCH manager 4/6] ui: dc/UserView: disable Password button based on realm type

Dominik Csapak d.csapak at proxmox.com
Thu Jul 1 14:25:04 CEST 2021


Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/Utils.js       | 5 +++++
 www/manager6/dc/UserView.js | 9 +++++++++
 2 files changed, 14 insertions(+)

diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index e642e283..fbd2dfa8 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -734,6 +734,7 @@ Ext.define('PVE.Utils', {
 	    syncipanel: 'pveAuthLDAPSyncPanel',
 	    add: true,
 	    tfa: true,
+	    pwchange: true,
 	},
 	ldap: {
 	    name: gettext('LDAP Server'),
@@ -741,23 +742,27 @@ Ext.define('PVE.Utils', {
 	    syncipanel: 'pveAuthLDAPSyncPanel',
 	    add: true,
 	    tfa: true,
+	    pwchange: true,
 	},
 	openid: {
 	    name: gettext('OpenID Server'),
 	    ipanel: 'pveAuthOpenIDPanel',
 	    add: true,
 	    tfa: false,
+	    pwchange: false,
 	},
 	pam: {
 	    name: 'Linux PAM',
 	    ipanel: 'pveAuthBasePanel',
 	    add: false,
 	    tfa: true,
+	    pwchange: true,
 	},
 	pve: {
 	    name: 'Proxmox VE authentication server',
 	    ipanel: 'pveAuthBasePanel',
 	    add: false,
+	    pwchange: true,
 	},
     },
 
diff --git a/www/manager6/dc/UserView.js b/www/manager6/dc/UserView.js
index 20ae3090..957b7724 100644
--- a/www/manager6/dc/UserView.js
+++ b/www/manager6/dc/UserView.js
@@ -58,6 +58,15 @@ Ext.define('PVE.dc.UserView', {
 	    text: gettext('Password'),
 	    disabled: true,
 	    selModel: sm,
+	    enableFn: function(record) {
+		if (record.data.realmtype) {
+		    let type = record.data.realmtype;
+		    if (PVE.Utils.authSchema[type]) {
+			return !!PVE.Utils.authSchema[type].pwchange;
+		    }
+		}
+		return false;
+	    },
 	    handler: function(btn, event, rec) {
 		Ext.create('Proxmox.window.PasswordEdit', {
 		    userid: rec.data.userid,
-- 
2.30.2






More information about the pve-devel mailing list