Files
wireplumber/modules/module-client-permissions.c
George Kiagiadakis a63f2bb99b lib/wp: merge both WpRemote & WpRemotePipewire in WpCore
In practice we always create a remote and connect to pipewire.
Any other scenario is invalid, therefore, it is not justified
to be confused with so many classes for such small functionality.
This simplifies a lot the modules code.

Also, this commit exposes the pw_core and pw_remote objects
out of WpCore. This is in practice useful when dealing with low-level
pw and spa factories, which are used in the monitors. Let's not
add API wrappers for everything... Bindings will never use this
functionality anyway, since it depends on low level pipewire C API.
2019-09-07 17:55:46 +03:00

39 lines
1.1 KiB
C

/* WirePlumber
*
* Copyright © 2019 Collabora Ltd.
* @author George Kiagiadakis <george.kiagiadakis@collabora.com>
*
* SPDX-License-Identifier: MIT
*/
#include <wp/wp.h>
#include <pipewire/pipewire.h>
static void
client_added (WpCore * core, WpProxyClient *client, gpointer data)
{
g_autoptr (WpProperties) properties = NULL;
const char *access;
guint32 id = wp_proxy_get_global_id (WP_PROXY (client));
g_debug ("Client added: %d", id);
properties = wp_proxy_client_get_properties (client);
access = wp_properties_get (properties, PW_KEY_ACCESS);
if (!g_strcmp0 (access, "flatpak") || !g_strcmp0 (access, "restricted")) {
g_debug ("Granting full access to client %d", id);
wp_proxy_client_update_permissions (client, 1, -1, PW_PERM_RWX);
}
}
void
wireplumber__module_init (WpModule * module, WpCore * core, GVariant * args)
{
wp_core_set_default_proxy_features (core, WP_TYPE_PROXY_CLIENT,
WP_PROXY_FEATURE_PW_PROXY | WP_PROXY_FEATURE_INFO);
g_signal_connect(core, "remote-global-added::client",
(GCallback) client_added, NULL);
}