all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH proxmox{_login_manager, _dart_api_client} v3 0/2] fix #6409: login manager doesn't pre-selects default authentication realm
@ 2025-06-03 12:20 Shan Shaji
  2025-06-03 12:20 ` [pve-devel] [PATCH proxmox_login_manager v3 1/1] fix #6409: add `isDefaultRealm` check to pre-select realm in login form Shan Shaji
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Shan Shaji @ 2025-06-03 12:20 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.

History
==========

v2: https://lore.proxmox.com/pve-devel/20250526154137.116322-1-s.shaji@proxmox.com/T/#t

changes since v2:
* removed "This commit" string from commit messages. 
* fixed `StateError` in `singleWhere` function which can happen 
  when both conditions are true. 
* If a realm is already saved then that selection will have priority. 

proxmox_login_manager:

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

 lib/proxmox_login_form.dart | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)


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(+)


Summary over all repositories:
  2 files changed, 8 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] 4+ messages in thread

* [pve-devel] [PATCH proxmox_login_manager v3 1/1] fix #6409: add `isDefaultRealm` check to pre-select realm in login form
  2025-06-03 12:20 [pve-devel] [PATCH proxmox{_login_manager, _dart_api_client} v3 0/2] fix #6409: login manager doesn't pre-selects default authentication realm Shan Shaji
@ 2025-06-03 12:20 ` Shan Shaji
  2025-06-03 12:20 ` [pve-devel] [PATCH proxmox_dart_api_client v3 1/1] fix #6409: add `default` property to `PveAccessDomainModel` Shan Shaji
  2025-06-06  8:18 ` [pve-devel] [PATCH proxmox{_login_manager, _dart_api_client} v3 0/2] fix #6409: login manager doesn't pre-selects default authentication realm Michael Köppl
  2 siblings, 0 replies; 4+ messages in thread
From: Shan Shaji @ 2025-06-03 12:20 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.

Add `isDefaultRealm` boolean check to find the default realm.
Also the user's selection will have priority if a realm is
already saved.

Signed-off-by: Shan Shaji <s.shaji@proxmox.com>
---

changes since v2:
* removed "this commit" string from commit message.
* fixed `StateError` in `singleWhere` function which can happen
  when both conditions are true.
* if a realm is already saved then that realm will have priority
  over default realm. 

lib/proxmox_login_form.dart | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/proxmox_login_form.dart b/lib/proxmox_login_form.dart
index 5916563..7728594 100644
--- a/lib/proxmox_login_form.dart
+++ b/lib/proxmox_login_form.dart
@@ -697,7 +697,9 @@ 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) => widget.userModel?.realm != null
+          ? e!.realm == widget.userModel?.realm
+          : e?.isDefaultRealm == true,
       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] 4+ messages in thread

* [pve-devel] [PATCH proxmox_dart_api_client v3 1/1] fix #6409: add `default` property to `PveAccessDomainModel`
  2025-06-03 12:20 [pve-devel] [PATCH proxmox{_login_manager, _dart_api_client} v3 0/2] fix #6409: login manager doesn't pre-selects default authentication realm Shan Shaji
  2025-06-03 12:20 ` [pve-devel] [PATCH proxmox_login_manager v3 1/1] fix #6409: add `isDefaultRealm` check to pre-select realm in login form Shan Shaji
@ 2025-06-03 12:20 ` Shan Shaji
  2025-06-06  8:18 ` [pve-devel] [PATCH proxmox{_login_manager, _dart_api_client} v3 0/2] fix #6409: login manager doesn't pre-selects default authentication realm Michael Köppl
  2 siblings, 0 replies; 4+ messages in thread
From: Shan Shaji @ 2025-06-03 12:20 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.

Add `default` property and 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>
---
 
 changes since v2:
 * remove "This commit" from the commit message. 

 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] 4+ messages in thread

* Re: [pve-devel] [PATCH proxmox{_login_manager, _dart_api_client} v3 0/2] fix #6409: login manager doesn't pre-selects default authentication realm
  2025-06-03 12:20 [pve-devel] [PATCH proxmox{_login_manager, _dart_api_client} v3 0/2] fix #6409: login manager doesn't pre-selects default authentication realm Shan Shaji
  2025-06-03 12:20 ` [pve-devel] [PATCH proxmox_login_manager v3 1/1] fix #6409: add `isDefaultRealm` check to pre-select realm in login form Shan Shaji
  2025-06-03 12:20 ` [pve-devel] [PATCH proxmox_dart_api_client v3 1/1] fix #6409: add `default` property to `PveAccessDomainModel` Shan Shaji
@ 2025-06-06  8:18 ` Michael Köppl
  2 siblings, 0 replies; 4+ messages in thread
From: Michael Köppl @ 2025-06-06  8:18 UTC (permalink / raw)
  To: Proxmox VE development discussion, Shan Shaji

Gave this another spin in my Android emulator. User's realm selection is
now respected if there is one, otherwise the site's selected default is
used. Did not notice anything off. With my comments from v2 addressed
and everything working as expected, consider this:

Reviewed-by: Michael Köppl <m.koeppl@proxmox.com>
Tested-by: Michael Köppl <m.koeppl@proxmox.com>

On 6/3/25 14:20, Shan Shaji wrote:
> 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.
> 
> History
> ==========
> 
> v2: https://lore.proxmox.com/pve-devel/20250526154137.116322-1-s.shaji@proxmox.com/T/#t
> 
> changes since v2:
> * removed "This commit" string from commit messages. 
> * fixed `StateError` in `singleWhere` function which can happen 
>   when both conditions are true. 
> * If a realm is already saved then that selection will have priority. 
> 
> proxmox_login_manager:
> 
> Shan Shaji (1):
>   fix #6409: add `isDefaultRealm` check to pre-select realm in login
>     form
> 
>  lib/proxmox_login_form.dart | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> 
> 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(+)
> 
> 
> Summary over all repositories:
>   2 files changed, 8 insertions(+), 1 deletions(-)
> 



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

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

end of thread, other threads:[~2025-06-06  8:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-03 12:20 [pve-devel] [PATCH proxmox{_login_manager, _dart_api_client} v3 0/2] fix #6409: login manager doesn't pre-selects default authentication realm Shan Shaji
2025-06-03 12:20 ` [pve-devel] [PATCH proxmox_login_manager v3 1/1] fix #6409: add `isDefaultRealm` check to pre-select realm in login form Shan Shaji
2025-06-03 12:20 ` [pve-devel] [PATCH proxmox_dart_api_client v3 1/1] fix #6409: add `default` property to `PveAccessDomainModel` Shan Shaji
2025-06-06  8:18 ` [pve-devel] [PATCH proxmox{_login_manager, _dart_api_client} v3 0/2] fix #6409: login manager doesn't pre-selects default authentication realm Michael Köppl

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal