public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup 1/3] fix #3939: add default-realm field to node config
@ 2022-03-23 13:01 Matthias Heiserer
  2022-03-23 13:01 ` [pbs-devel] [PATCH proxmox-backup 2/3] fix #3939: set default value in domains endpoint Matthias Heiserer
  2022-03-23 13:01 ` [pbs-devel] [PATCH proxmox-backup 3/3] fix #3939: ui: default realm setting in NodeOptionView Matthias Heiserer
  0 siblings, 2 replies; 9+ messages in thread
From: Matthias Heiserer @ 2022-03-23 13:01 UTC (permalink / raw)
  To: pbs-devel

This is probably not ideal, but I like it better than storing the
default value in the domains config, especially as pam and pbs
auth are hardcoded in the domains endpoint.

Signed-off-by: Matthias Heiserer <m.heiserer@proxmox.com>
---
 pbs-api-types/src/lib.rs |  2 +-
 src/api2/node/config.rs  |  4 ++++
 src/config/node.rs       | 12 ++++++++++--
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/pbs-api-types/src/lib.rs b/pbs-api-types/src/lib.rs
index 421566f7..e1544d76 100644
--- a/pbs-api-types/src/lib.rs
+++ b/pbs-api-types/src/lib.rs
@@ -59,7 +59,7 @@ pub use userid::Userid;
 pub use userid::{Realm, RealmRef};
 pub use userid::{Tokenname, TokennameRef};
 pub use userid::{Username, UsernameRef};
-pub use userid::{PROXMOX_GROUP_ID_SCHEMA, PROXMOX_TOKEN_ID_SCHEMA, PROXMOX_TOKEN_NAME_SCHEMA};
+pub use userid::{PROXMOX_GROUP_ID_SCHEMA, PROXMOX_TOKEN_ID_SCHEMA, PROXMOX_TOKEN_NAME_SCHEMA, PROXMOX_AUTH_REALM_SCHEMA};
 
 #[macro_use]
 mod user;
diff --git a/src/api2/node/config.rs b/src/api2/node/config.rs
index 3b267adc..068d54ca 100644
--- a/src/api2/node/config.rs
+++ b/src/api2/node/config.rs
@@ -66,6 +66,8 @@ pub enum DeletableProperty {
     default_lang,
     /// Delete any description
     description,
+    /// Delete the default-realm property.
+    default_realm,
 }
 
 #[api(
@@ -127,6 +129,7 @@ pub fn update_node_config(
                 DeletableProperty::ciphers_tls_1_2 => { config.ciphers_tls_1_2 = None; },
                 DeletableProperty::default_lang => { config.default_lang = None; },
                 DeletableProperty::description => { config.description = None; },
+                DeletableProperty::default_realm => { config.default_realm = None; },
             }
         }
     }
@@ -143,6 +146,7 @@ pub fn update_node_config(
     if update.ciphers_tls_1_2.is_some() { config.ciphers_tls_1_2 = update.ciphers_tls_1_2; }
     if update.default_lang.is_some() { config.default_lang = update.default_lang; }
     if update.description.is_some() { config.description = update.description; }
+    if update.default_realm.is_some() { config.default_realm = update.default_realm; }
 
     crate::config::node::save_config(&config)?;
 
diff --git a/src/config/node.rs b/src/config/node.rs
index ac6774e3..c6f2e50d 100644
--- a/src/config/node.rs
+++ b/src/config/node.rs
@@ -10,7 +10,7 @@ use proxmox_http::ProxyConfig;
 
 use pbs_api_types::{
     EMAIL_SCHEMA, MULTI_LINE_COMMENT_SCHEMA, OPENSSL_CIPHERS_TLS_1_2_SCHEMA,
-    OPENSSL_CIPHERS_TLS_1_3_SCHEMA,
+    OPENSSL_CIPHERS_TLS_1_3_SCHEMA, PROXMOX_AUTH_REALM_SCHEMA
 };
 
 use pbs_buildcfg::configdir;
@@ -175,7 +175,11 @@ pub enum Translation {
         "description" : {
             optional: true,
             schema: MULTI_LINE_COMMENT_SCHEMA,
-        }
+        },
+        "default-realm": {
+            schema: PROXMOX_AUTH_REALM_SCHEMA,
+            optional: true,
+        },
     },
 )]
 #[derive(Deserialize, Serialize, Updater)]
@@ -222,6 +226,10 @@ pub struct NodeConfig {
     /// Node description
     #[serde(skip_serializing_if = "Option::is_none")]
     pub description: Option<String>,
+
+    /// Default realm for authenticating
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub default_realm: Option<String>,
 }
 
 impl NodeConfig {
-- 
2.30.2





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

end of thread, other threads:[~2022-04-11 11:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-23 13:01 [pbs-devel] [PATCH proxmox-backup 1/3] fix #3939: add default-realm field to node config Matthias Heiserer
2022-03-23 13:01 ` [pbs-devel] [PATCH proxmox-backup 2/3] fix #3939: set default value in domains endpoint Matthias Heiserer
2022-04-11  8:12   ` Thomas Lamprecht
2022-04-11 10:20     ` Matthias Heiserer
2022-04-11 11:34       ` Thomas Lamprecht
2022-03-23 13:01 ` [pbs-devel] [PATCH proxmox-backup 3/3] fix #3939: ui: default realm setting in NodeOptionView Matthias Heiserer
2022-04-11  8:13   ` Thomas Lamprecht
2022-04-11 10:03     ` Matthias Heiserer
2022-04-11 11:41       ` Thomas Lamprecht

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