public inbox for pmg-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Markus Frank <m.frank@proxmox.com>
To: pmg-devel@lists.proxmox.com
Subject: [pmg-devel] [PATCH pmg-gui v8 13/13] user: add realm field for user creation
Date: Wed, 26 Feb 2025 15:07:40 +0100	[thread overview]
Message-ID: <20250226140740.55612-14-m.frank@proxmox.com> (raw)
In-Reply-To: <20250226140740.55612-1-m.frank@proxmox.com>

Signed-off-by: Markus Frank <m.frank@proxmox.com>
---
 js/UserEdit.js | 47 ++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 40 insertions(+), 7 deletions(-)

diff --git a/js/UserEdit.js b/js/UserEdit.js
index bd94686..4c1e540 100644
--- a/js/UserEdit.js
+++ b/js/UserEdit.js
@@ -29,6 +29,26 @@ Ext.define('PMG.UserEdit', {
 	};
     },
 
+    viewModel: {
+	data: {
+	    realm: 'pmg',
+	},
+	formulas: {
+	    maySetPassword: function(get) {
+		let realm = get('realm');
+
+		let view = this.getView();
+		let realmStore = view.down('pmxRealmComboBox').getStore();
+		if (realmStore.isLoaded()) {
+		    let rec = realmStore.findRecord('realm', realm, 0, false, true, true);
+		    return rec.data.type === 'pmg' && view.isCreate;
+		} else {
+		    return view.isCreate;
+		}
+	    },
+	},
+    },
+
     items: {
 	xtype: 'inputpanel',
 	column1: [
@@ -58,9 +78,9 @@ Ext.define('PMG.UserEdit', {
 			field.next().validate();
                     },
 		},
-		cbind: {
-		    hidden: '{!isCreate}',
-		    disabled: '{!isCreate}',
+		bind: {
+		    hidden: '{!maySetPassword}',
+		    disabled: '{!maySetPassword}',
 		},
 	    },
 	    {
@@ -72,9 +92,9 @@ Ext.define('PMG.UserEdit', {
 		initialPassField: 'password',
 		allowBlank: false,
 		submitValue: false,
-		cbind: {
-		    hidden: '{!isCreate}',
-		    disabled: '{!isCreate}',
+		bind: {
+		    hidden: '{!maySetPassword}',
+		    disabled: '{!maySetPassword}',
 		},
 	    },
 	    {
@@ -111,6 +131,19 @@ Ext.define('PMG.UserEdit', {
 	],
 
 	column2: [
+	    {
+		xtype: 'pmxRealmComboBox',
+		reference: 'realmfield',
+		name: 'realm',
+		baseUrl: '/access/auth-realm',
+		bind: {
+		    value: '{realm}',
+		},
+		cbind: {
+		    disabled: '{!isCreate}',
+		    hidden: '{!isCreate}',
+		},
+	    },
 	    {
 		xtype: 'proxmoxtextfield',
 		name: 'firstname',
@@ -170,7 +203,7 @@ Ext.define('PMG.UserEdit', {
 	}
 
 	if (me.isCreate) {
-	    values.userid = values.username + '@pmg';
+	    values.userid = values.username + '@' + values.realm;
 	}
 
 	delete values.username;
-- 
2.39.5



_______________________________________________
pmg-devel mailing list
pmg-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel


  parent reply	other threads:[~2025-02-26 14:08 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-26 14:07 [pmg-devel] [PATCH perl-rs/pmg-api/widget-toolkit/pmg-gui v8 0/13] fix #3892: OpenID Connect Markus Frank
2025-02-26 14:07 ` [pmg-devel] [PATCH proxmox-perl-rs v8 1/13] move openid code from pve-rs to common Markus Frank
2025-02-26 16:57   ` [pmg-devel] applied: " Thomas Lamprecht
2025-02-26 14:07 ` [pmg-devel] [PATCH proxmox-perl-rs v8 2/13] remove empty PMG::RS::OpenId package to avoid confusion Markus Frank
2025-02-26 16:58   ` [pmg-devel] applied: " Thomas Lamprecht
2025-02-26 17:55   ` [pmg-devel] " Stoiko Ivanov
2025-02-26 14:07 ` [pmg-devel] [PATCH pmg-api v8 3/13] config: add plugin system for authentication realms Markus Frank
2025-02-26 14:40   ` Stoiko Ivanov
2025-02-26 14:07 ` [pmg-devel] [PATCH pmg-api v8 4/13] config: add oidc type authentication realm Markus Frank
2025-02-26 14:07 ` [pmg-devel] [PATCH pmg-api v8 5/13] api: add/update/remove authentication realms like in PVE Markus Frank
2025-02-26 14:07 ` [pmg-devel] [PATCH pmg-api v8 6/13] api: oidc login similar to PVE Markus Frank
2025-02-26 14:41   ` Stoiko Ivanov
2025-02-26 14:07 ` [pmg-devel] [PATCH pmg-api v8 7/13] api: users: create user with a specified realm Markus Frank
2025-02-26 15:36   ` Mira Limbeck
2025-02-26 16:29     ` Mira Limbeck
2025-02-26 14:07 ` [pmg-devel] [PATCH widget-toolkit v8 08/13] fix: window: AuthEditBase: rename variable 'realm' to 'type' Markus Frank
2025-02-26 17:52   ` [pmg-devel] partially-applied-series: " Thomas Lamprecht
2025-02-26 14:07 ` [pmg-devel] [PATCH widget-toolkit v8 09/13] panel: AuthView: change API path in pmx-domains model Markus Frank
2025-02-26 14:07 ` [pmg-devel] [PATCH widget-toolkit v8 10/13] form: RealmComboBox: add option to change the API path Markus Frank
2025-02-26 14:07 ` [pmg-devel] [PATCH pmg-gui v8 11/13] login: add option to login with OIDC realm Markus Frank
2025-02-26 14:07 ` [pmg-devel] [PATCH pmg-gui v8 12/13] add realms panel to user management Markus Frank
2025-02-26 14:07 ` Markus Frank [this message]
2025-02-26 20:17 ` [pmg-devel] applied: [PATCH perl-rs/pmg-api/widget-toolkit/pmg-gui v8 0/13] fix #3892: OpenID Connect Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250226140740.55612-14-m.frank@proxmox.com \
    --to=m.frank@proxmox.com \
    --cc=pmg-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal