all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Azharul Haque <haque@azharul.com>
To: pve-devel@lists.proxmox.com
Cc: haque@azharul.com
Subject: [PATCH dart-api-client v3 1/2] fix #4281: access: add `type` property to `PveAccessDomainModel`
Date: Thu, 20 Aug 2026 23:41:38 -0400	[thread overview]
Message-ID: <20260821034147.30194-2-haque@azharul.com> (raw)
In-Reply-To: <20260821034147.30194-1-haque@azharul.com>

The realm/domain list returned by /access/domains always includes a
`type` field (pam, pve, ldap, ad, openid), but the model never captured
it. Without it, callers have no way to tell an OpenID Connect realm
apart from a password-based one, which is why the login form falls back
to showing username/password fields even for realms that require a
browser-based OpenID login.

Model the field as a built_value EnumClass (`PveAccessDomainType`)
rather than a plain string, since PVE's realm types are a fixed set;
this gives compile-time checking and avoids stringly-typed comparisons.
The enum is named following this package's existing `Pve*Type`
convention (`PveNodesDiskListType`, `PveTaskLogStatusType`, ...) and
covers all five realm types PVE supports. Note that unlike the previous
plain string, deserializing a realm list containing an unknown type now
throws; that is the standard built_value EnumClass behavior and
acceptable since the set of realm types is fixed.

Also add an `isOpenIdRealm` convenience getter, used by the login form
in the following commits.

Suggested-by: Shan Shaji <s.shaji@proxmox.com>
Signed-off-by: Azharul Haque <haque@azharul.com>
---
 lib/src/models/pve_access_domain_model.dart | 18 ++++++++++++++++++
 lib/src/models/serializers.dart             |  3 ++-
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/lib/src/models/pve_access_domain_model.dart b/lib/src/models/pve_access_domain_model.dart
index 6298bbe..39e00b9 100644
--- a/lib/src/models/pve_access_domain_model.dart
+++ b/lib/src/models/pve_access_domain_model.dart
@@ -1,3 +1,4 @@
+import 'package:built_collection/built_collection.dart';
 import 'package:built_value/built_value.dart';
 import 'package:built_value/serializer.dart';
 
@@ -7,12 +8,14 @@ abstract class PveAccessDomainModel
     implements Built<PveAccessDomainModel, PveAccessDomainModelBuilder> {
   // Fields
   String get realm;
+  PveAccessDomainType get type;
   String? get comment;
   String? get tfa;
   @BuiltValueField(wireName: 'default')
   int? get defaultValue;
 
   bool get isDefaultRealm => defaultValue == 1;
+  bool get isOpenIdRealm => type == PveAccessDomainType.openid;
 
   PveAccessDomainModel._();
 
@@ -23,3 +26,18 @@ abstract class PveAccessDomainModel
   static Serializer<PveAccessDomainModel> get serializer =>
       _$pveAccessDomainModelSerializer;
 }
+
+class PveAccessDomainType extends EnumClass {
+  static const PveAccessDomainType ad = _$ad;
+  static const PveAccessDomainType ldap = _$ldap;
+  static const PveAccessDomainType openid = _$openid;
+  static const PveAccessDomainType pam = _$pam;
+  static const PveAccessDomainType pve = _$pve;
+
+  const PveAccessDomainType._(super.name);
+
+  static BuiltSet<PveAccessDomainType> get values => _$values;
+  static PveAccessDomainType valueOf(String name) => _$valueOf(name);
+  static Serializer<PveAccessDomainType> get serializer =>
+      _$pveAccessDomainTypeSerializer;
+}
diff --git a/lib/src/models/serializers.dart b/lib/src/models/serializers.dart
index 0be80fc..458d105 100644
--- a/lib/src/models/serializers.dart
+++ b/lib/src/models/serializers.dart
@@ -39,7 +39,8 @@ part 'serializers.g.dart';
   PveAccessUserModel,
   PveAccessGroupModel,
   PveAccessRoleModel,
-  PveAccessDomainModel
+  PveAccessDomainModel,
+  PveAccessDomainType
 ])
 final Serializers serializers = (_$serializers.toBuilder()
       ..addPlugin(StandardJsonPlugin())
-- 
2.50.1 (Apple Git-155)




  reply	other threads:[~2026-08-25  8:09 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-10  5:40 [PATCH 0/2] android: register OpenID Connect callback activity for #4281 Azharul Haque
2026-08-10  5:40 ` [PATCH 1/2] fix #4281: android: register OpenID Connect callback activity Azharul Haque
2026-08-10  5:40 ` [PATCH 2/2] fix #4281: android: match renamed OpenID callback scheme Azharul Haque
2026-08-10 13:59 ` [PATCH 0/2] android: register OpenID Connect callback activity for #4281 Shan Shaji
2026-08-10 14:47   ` [PATCH v2 0/7] app: implement OpenID Connect (OAuth) realm login (#4281) Azharul Haque
2026-08-10 14:47     ` [PATCH dart-api-client v2 1/2] fix #4281: access: add `type` property to `PveAccessDomainModel` Azharul Haque
2026-08-20  9:17       ` Shan Shaji
2026-08-20 13:37         ` Azharul Haque
2026-08-20 14:39           ` Shan Shaji
2026-08-21  2:56             ` Azharul Haque
2026-08-21  8:00               ` Shan Shaji
2026-08-10 14:47     ` [PATCH dart-api-client v2 2/2] fix #4281: access: add OpenID Connect auth-url/login helpers Azharul Haque
2026-08-20  9:48       ` Shan Shaji
2026-08-20 13:41         ` Azharul Haque
2026-08-10 14:47     ` [PATCH login-manager v2 1/3] fix #4281: ui: add OpenID Connect login flow to login form Azharul Haque
2026-08-20 12:31       ` Shan Shaji
2026-08-10 14:47     ` [PATCH login-manager v2 2/3] fix #4281: ui: fix stale Continue button state on realm switch Azharul Haque
2026-08-10 14:47     ` [PATCH login-manager v2 3/3] fix #4281: ui: use a namespaced OpenID callback scheme Azharul Haque
2026-08-20 14:28       ` Shan Shaji
2026-08-10 14:47     ` [PATCH flutter-frontend v2 1/2] fix #4281: android: register OpenID Connect callback activity Azharul Haque
2026-08-20 14:01       ` Shan Shaji
2026-08-10 14:47     ` [PATCH flutter-frontend v2 2/2] fix #4281: android: match renamed OpenID callback scheme Azharul Haque
2026-08-21  3:41     ` [PATCH v3 00/10] app: implement OpenID Connect (OAuth) realm login (#4281) Azharul Haque
2026-08-21  3:41       ` Azharul Haque [this message]
2026-08-21  3:41       ` [PATCH dart-api-client v3 2/2] fix #4281: access: add OpenID Connect auth-url/login helpers Azharul Haque
2026-08-21  3:41       ` [PATCH login-manager v3 1/5] fix #4281: deps: add flutter_web_auth_2 dependency Azharul Haque
2026-08-21  3:41       ` [PATCH login-manager v3 2/5] refactor: ui: factor out shared login tail into _finishLogin Azharul Haque
2026-08-21  3:41       ` [PATCH login-manager v3 3/5] refactor: ui: split password form into its own widget Azharul Haque
2026-08-21  3:41       ` [PATCH login-manager v3 4/5] fix #4281: ui: add OpenID Connect login flow to login form Azharul Haque
2026-08-21  3:41       ` [PATCH login-manager v3 5/5] fix #4281: ui: fix stale Continue button state on realm switch Azharul Haque
2026-08-21  3:41       ` [PATCH flutter-frontend v3 1/3] chore: regenerate plugin registrant for flutter_web_auth_2 Azharul Haque
2026-08-21  3:41       ` [PATCH flutter-frontend v3 2/3] fix #4281: android: set taskAffinity="" on MainActivity Azharul Haque
2026-08-21  3:41       ` [PATCH flutter-frontend v3 3/3] fix #4281: android: register OpenID Connect callback activity Azharul Haque

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=20260821034147.30194-2-haque@azharul.com \
    --to=haque@azharul.com \
    --cc=pve-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 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