diff options
author | Dan Williams <dan@ioncontrol.co> | 2025-04-29 20:54:36 -0500 |
---|---|---|
committer | Dan Williams <dan@ioncontrol.co> | 2025-05-08 20:08:06 -0500 |
commit | ef5cee3ab578c2fde8ca6cc636f10acfdb79f123 (patch) | |
tree | 02510944a5782a9c4047234b747fdc02dd8f31c8 /src/mm-iface-modem-cell-broadcast.c | |
parent | 7262b46a82642b7232ef922b827d77626a93eec0 (diff) |
auth-provider: move auth provider logic into each class
Rather than make all of them rely on MMBaseModem for it. This
lets us disentangle dependencies for easier unit testing.
For interfaces, rather than casting directly to MMBaseModem
use intermediate interfaces (MMIfaceAuth and MMIfaceOpLock)
that tests can fake out.
Signed-off-by: Dan Williams <dan@ioncontrol.co>
Diffstat (limited to 'src/mm-iface-modem-cell-broadcast.c')
-rw-r--r-- | src/mm-iface-modem-cell-broadcast.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/mm-iface-modem-cell-broadcast.c b/src/mm-iface-modem-cell-broadcast.c index f543d8f9..b29d01c5 100644 --- a/src/mm-iface-modem-cell-broadcast.c +++ b/src/mm-iface-modem-cell-broadcast.c @@ -79,13 +79,14 @@ set_channels_ready (MMIfaceModemCellBroadcast *self, } static void -handle_set_channels_auth_ready (MMBaseModem *self, +handle_set_channels_auth_ready (MMIfaceAuth *_self, GAsyncResult *res, HandleSetChannelsCellBroadcastContext *ctx) { + MMIfaceModemCellBroadcast *self = MM_IFACE_MODEM_CELL_BROADCAST (_self); GError *error = NULL; - if (!mm_base_modem_authorize_finish (self, res, &error)) { + if (!mm_iface_auth_authorize_finish (_self, res, &error)) { mm_dbus_method_invocation_take_error (ctx->invocation, error); handle_set_channels_context_free (ctx); return; @@ -128,7 +129,8 @@ handle_set_channels (MmGdbusModemCellBroadcast *skeleton, ctx->invocation = g_object_ref (invocation); ctx->self = g_object_ref (self); ctx->channels = mm_common_cell_broadcast_channels_variant_to_garray (channels); - mm_base_modem_authorize (MM_BASE_MODEM (self), + + mm_iface_auth_authorize (MM_IFACE_AUTH (self), invocation, MM_AUTHORIZATION_DEVICE_CONTROL, (GAsyncReadyCallback)handle_set_channels_auth_ready, @@ -173,14 +175,15 @@ handle_delete_ready (MMCbmList *list, } static void -handle_delete_auth_ready (MMBaseModem *self, +handle_delete_auth_ready (MMIfaceAuth *_self, GAsyncResult *res, HandleDeleteContext *ctx) { + MMIfaceModemCellBroadcast *self = MM_IFACE_MODEM_CELL_BROADCAST (_self); g_autoptr(MMCbmList) list = NULL; GError *error = NULL; - if (!mm_base_modem_authorize_finish (self, res, &error)) { + if (!mm_iface_auth_authorize_finish (_self, res, &error)) { mm_dbus_method_invocation_take_error (ctx->invocation, error); handle_delete_context_free (ctx); return; @@ -229,7 +232,7 @@ handle_delete (MmGdbusModemCellBroadcast *skeleton, ctx->self = g_object_ref (self); ctx->path = g_strdup (path); - mm_base_modem_authorize (MM_BASE_MODEM (self), + mm_iface_auth_authorize (MM_IFACE_AUTH (self), invocation, MM_AUTHORIZATION_CELL_BROADCAST, (GAsyncReadyCallback)handle_delete_auth_ready, |