diff options
author | Dan Williams <dan@ioncontrol.co> | 2025-05-08 20:10:48 -0500 |
---|---|---|
committer | Dan Williams <dan@ioncontrol.co> | 2025-05-08 20:10:48 -0500 |
commit | efcc960b130356e6b05d05a915ff0f9646b00d5f (patch) | |
tree | cf209fc07098e68c65dca219fee38a826dbcbf1a /src/mm-auth-provider.c | |
parent | 02942a04f95f64cda36360c72961fe0e20459ad4 (diff) | |
parent | 1fa21fcc48b271a8dc2191104e35bf4e95fa2331 (diff) |
Merge request !1344 from 'cbm-remove-modem'
Begin removing usage of MMBaseModem from leaf classes
https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1344
Diffstat (limited to 'src/mm-auth-provider.c')
-rw-r--r-- | src/mm-auth-provider.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/mm-auth-provider.c b/src/mm-auth-provider.c index 5b4b13f3..2455da30 100644 --- a/src/mm-auth-provider.c +++ b/src/mm-auth-provider.c @@ -22,6 +22,7 @@ #include "mm-log-object.h" #include "mm-utils.h" #include "mm-auth-provider.h" +#include "mm-context.h" #if defined WITH_POLKIT # include <polkit/polkit.h> @@ -128,6 +129,13 @@ mm_auth_provider_authorize (MMAuthProvider *self, task = g_task_new (self, cancellable, callback, user_data); + /* When running in the session bus for tests, default to always allow */ + if (mm_context_get_test_session ()) { + g_task_return_boolean (task, TRUE); + g_object_unref (task); + return; + } + #if defined WITH_POLKIT { AuthorizeContext *ctx; @@ -218,3 +226,40 @@ mm_auth_provider_class_init (MMAuthProviderClass *class) } MM_DEFINE_SINGLETON_GETTER (MMAuthProvider, mm_auth_provider_get, MM_TYPE_AUTH_PROVIDER) + +/*****************************************************************************/ +/* Auth interface */ + +G_DEFINE_INTERFACE (MMIfaceAuth, mm_iface_auth, G_TYPE_OBJECT) + +void +mm_iface_auth_authorize (MMIfaceAuth *self, + GDBusMethodInvocation *invocation, + const gchar *authorization, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_assert (MM_IFACE_AUTH_GET_IFACE (self)->authorize != NULL); + + MM_IFACE_AUTH_GET_IFACE (self)->authorize (self, + invocation, + authorization, + callback, + user_data); +} + +gboolean +mm_iface_auth_authorize_finish (MMIfaceAuth *self, + GAsyncResult *res, + GError **error) +{ + g_assert (MM_IFACE_AUTH_GET_IFACE (self)->authorize_finish != NULL); + + return MM_IFACE_AUTH_GET_IFACE (self)->authorize_finish (self, res, error); +} + +static void +mm_iface_auth_default_init (MMIfaceAuthInterface *iface) +{ +} + |