public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH proxmox{_dart_api_client, _login_manager} 0/2] fix #6409: login manager doesn't pre-selects default authentication realm
@ 2025-05-26 15:08 Shan Shaji
  2025-05-26 15:08 ` [pve-devel] [PATCH proxmox_dart_api_client 1/2] fix #6409: add `default` property to `PveAccessDomainModel` Shan Shaji
  2025-05-26 15:08 ` [pve-devel] [PATCH proxmox_login_manager 2/2] fix #6409: add `isDefaultRealm` check to pre-select realm in login form Shan Shaji
  0 siblings, 2 replies; 3+ messages in thread
From: Shan Shaji @ 2025-05-26 15:08 UTC (permalink / raw)
  To: pve-devel

When the `default` property was selected inside the realm of the web UI,
the app's login page was not showing the default realm instead, 
it was always showing PAM.

To reproduce, follow the following steps:
on the web UI go to Datacenter -> Realms and  edit another realm than 
PAM, like PVE. There you can tick the "Default" checkbox. Now go to 
the app and try adding the domain, `PAM` will be selected as default. 

This patch series fixes the issue by adding the `default` property
to the `PveAccessDomainModel` and implementing the necessary 
check in the `_getAccessDomains` function.

proxmox_dart_api_client:

Shan Shaji (1):
  fix #6409: add `default` property to `PveAccessDomainModel`

 lib/src/models/pve_access_domain_model.dart | 5 +++++
 1 file changed, 5 insertions(+)


proxmox_login_manager:

Shan Shaji (1):
  fix #6409: add `isDefaultRealm` check to pre-select realm in login
    form

 lib/proxmox_login_form.dart | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


Summary over all repositories:
  2 files changed, 6 insertions(+), 1 deletions(-)

-- 
Generated by git-murpp 0.8.1


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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pve-devel] [PATCH proxmox_dart_api_client 1/2] fix #6409: add `default` property to `PveAccessDomainModel`
  2025-05-26 15:08 [pve-devel] [PATCH proxmox{_dart_api_client, _login_manager} 0/2] fix #6409: login manager doesn't pre-selects default authentication realm Shan Shaji
@ 2025-05-26 15:08 ` Shan Shaji
  2025-05-26 15:08 ` [pve-devel] [PATCH proxmox_login_manager 2/2] fix #6409: add `isDefaultRealm` check to pre-select realm in login form Shan Shaji
  1 sibling, 0 replies; 3+ messages in thread
From: Shan Shaji @ 2025-05-26 15:08 UTC (permalink / raw)
  To: pve-devel

When the default property was selected inside the realm
of the web UI, the app's login page was not showing the
default realm instead, it was always showing PAM.

This commit adds the `default` property and creates a getter boolean
that internally checks if the realm is default. This boolean is
used inside `pve_login_form.dart`, which is part of pve_login_manager.

Also the `default` property is named as `defaultValue` as `default` is
a keyword [0] in dart.

- [0] https://dart.dev/language/keywords

Signed-off-by: Shan Shaji <s.shaji@proxmox.com>
---
 lib/src/models/pve_access_domain_model.dart | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/src/models/pve_access_domain_model.dart b/lib/src/models/pve_access_domain_model.dart
index 81cb7a4..6298bbe 100644
--- a/lib/src/models/pve_access_domain_model.dart
+++ b/lib/src/models/pve_access_domain_model.dart
@@ -9,6 +9,11 @@ abstract class PveAccessDomainModel
   String get realm;
   String? get comment;
   String? get tfa;
+  @BuiltValueField(wireName: 'default')
+  int? get defaultValue;
+
+  bool get isDefaultRealm => defaultValue == 1;
+
   PveAccessDomainModel._();
 
   factory PveAccessDomainModel(
-- 
2.39.5



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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pve-devel] [PATCH proxmox_login_manager 2/2] fix #6409: add `isDefaultRealm` check to pre-select realm in login form
  2025-05-26 15:08 [pve-devel] [PATCH proxmox{_dart_api_client, _login_manager} 0/2] fix #6409: login manager doesn't pre-selects default authentication realm Shan Shaji
  2025-05-26 15:08 ` [pve-devel] [PATCH proxmox_dart_api_client 1/2] fix #6409: add `default` property to `PveAccessDomainModel` Shan Shaji
@ 2025-05-26 15:08 ` Shan Shaji
  1 sibling, 0 replies; 3+ messages in thread
From: Shan Shaji @ 2025-05-26 15:08 UTC (permalink / raw)
  To: pve-devel

When the `default` property was selected inside the realm of the web UI,
the app's login page was not showing the default realm instead, it was
always showing PAM.

This commit adds the `isDefaultRealm` boolean check to find the
default realm.

Signed-off-by: Shan Shaji <s.shaji@proxmox.com>
---
 lib/proxmox_login_form.dart | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/proxmox_login_form.dart b/lib/proxmox_login_form.dart
index 9ed9369..4ed495d 100644
--- a/lib/proxmox_login_form.dart
+++ b/lib/proxmox_login_form.dart
@@ -697,7 +697,7 @@ class _ProxmoxLoginPageState extends State<ProxmoxLoginPage> {
     response?.sort((a, b) => a!.realm.compareTo(b!.realm));
 
     final selection = response?.singleWhere(
-      (e) => e!.realm == widget.userModel?.realm || e.isDefault == 1,
+      (e) => e!.realm == widget.userModel?.realm || e.isDefaultRealm,
       orElse: () => response?.first,
     );
 
-- 
2.39.5



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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-05-26 15:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-26 15:08 [pve-devel] [PATCH proxmox{_dart_api_client, _login_manager} 0/2] fix #6409: login manager doesn't pre-selects default authentication realm Shan Shaji
2025-05-26 15:08 ` [pve-devel] [PATCH proxmox_dart_api_client 1/2] fix #6409: add `default` property to `PveAccessDomainModel` Shan Shaji
2025-05-26 15:08 ` [pve-devel] [PATCH proxmox_login_manager 2/2] fix #6409: add `isDefaultRealm` check to pre-select realm in login form Shan Shaji

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