WpPermissionManager — WirePlumber 0.5.17 documentation

# WpPermissionManager

struct WpPermissionManager

  The WpPermissionManager class is in charge of updating automatically permissions on interested objects every time they are added or removed for a particular client.

  WpPermissionManager API.

  GObject Signals

  client-properties-changed

        void
        client_properties_changed_callback (WpPermissionManager * self,
                                            WpClient *client,
                                            gpointer user_data)

    Emitted when the properties of an attached client change

    Parameters:

    - `client` - the client whose properties have changed

    Flags: G_SIGNAL_RUN_LAST

enum WpPermissionManagerFeatures

  Flags to be used as WpObjectFeatures for WpPermissionManager.

  Values:

  enumerator WP_PERMISSION_MANAGER_LOADED = (1 << 0)

    Loads the permission manager

guint32(*) WpPermissionMatchCallback (WpPermissionManager *self, WpClient *client, WpGlobalProxy *object, gpointer user_data)

  callback to set permissions on the matched global object

  Param self:

    the permission manager

  Param client:

    the client that will have its permissions updated

  Param object:

    the matched global

  Param user_data:

    the passed data

WpPermissionManager *wp_permission_manager_new(WpCore *core)

  Creates a new WpPermissionManager object.

  Parameters:

    - core -- the WpCore

  Returns:

    (transfer full): a new WpPermissionManager object

void wp_permission_manager_set_default_permissions(WpPermissionManager *self, guint32 permissions)

  Sets the default permissions that will be applied to all objects that don't match any interest.

  Parameters:

    - self -- the permission manager

    - permissions -- the default permissions to apply

guint32 wp_permission_manager_get_default_permissions(WpPermissionManager *self)

  Gets the default permissions that are applied to all objects that don't match any interest.

  Parameters:

    - self -- the permission manager

  Returns:

    the default permissions

void wp_permission_manager_set_core_permissions(WpPermissionManager *self, guint32 permissions)

  Sets the permissions that will be applied to the core object (ID 0).

  The core object is not visible to the permission manager's object manager because it is implicit in the PipeWire connection and not sent through the registry. This method allows setting explicit permissions on it, independent of the default permissions.

  If not set (or set to PW_PERM_INVALID), the core inherits default_permissions.

  Parameters:

    - self -- the permission manager

    - permissions -- the permissions to apply to the core object

guint32 wp_permission_manager_add_interest_match(WpPermissionManager *self, WpPermissionMatchCallback callback, gpointer user_data, WpObjectInterest *interest)

  Adds an interest match to apply permissions with callback in matched objects.

  Interest consists of a GType that the object must be an ancestor of (g_type_is_a() must match) and optionally, a set of additional constraints on certain properties of the object. Refer to WpObjectInterest for more details.

  Parameters:

    - self -- the permission manager

    - callback -- (scope async): the permissions match callback

    - user_data -- data to pass to callback

    - interest -- (transfer full): the interest

  Returns:

    the added match ID, or SPA_ID_INVALID if error

guint32 wp_permission_manager_add_interest_match_closure(WpPermissionManager *self, GClosure *closure, WpObjectInterest *interest)

  Adds an interest match to apply permissions with closure in matched objects.

  Interest consists of a GType that the object must be an ancestor of (g_type_is_a() must match) and optionally, a set of additional constraints on certain properties of the object. Refer to WpObjectInterest for more details.

  Parameters:

    - self -- the permission manager

    - closure -- (transfer full): the closure to apply permissions

    - interest -- (transfer full): the interest

  Returns:

    the added match ID, or SPA_ID_INVALID if error

guint32 wp_permission_manager_add_interest_match_simple(WpPermissionManager *self, guint32 permissions, WpObjectInterest *interest)

  Adds an interest match to apply same permissions in matched objects.

  Interest consists of a GType that the object must be an ancestor of (g_type_is_a() must match) and optionally, a set of additional constraints on certain properties of the object. Refer to WpObjectInterest for more details.

  Parameters:

    - self -- the permission manager

    - permissions -- the permissions to apply

    - interest -- (transfer full): the interest

  Returns:

    the added match ID, or SPA_ID_INVALID if error

guint32 wp_permission_manager_add_rules_match(WpPermissionManager *self, WpSpaJson *rules)

  Adds a rules match to apply permissions in matched objects.

  The rules must be defined in a JSON object using the same format as all the wireplumber/pipewire rules.

  Parameters:

    - self -- the permission manager

    - rules -- (transfer full): the JSON rules

  Returns:

    the added match ID, or SPA_ID_INVALID if error

void wp_permission_manager_remove_match(WpPermissionManager *self, guint32 match_id)

  Removes the previously added match so that the associated permissions are not applied anymore.

  Parameters:

    - self -- the permission manager

    - match_id -- the match ID to remove

void wp_permission_manager_update_permissions(WpPermissionManager *self)

  Updates permissions on all clients the permission manager has.

  The permission manager already updates permissions on all clients automatically when a new client or object is added, however, this might be needed if interests with closures or callbacks were added and something changed externally.

  Parameters:

    - self -- the permission manager

WP_TYPE_PERMISSION_MANAGER (wp_permission_manager_get_type ())

  The WpPermissionManager GType.