access-default: do not require the configuration file rules to operate

This commit is contained in:
George Kiagiadakis
2023-11-15 13:37:33 +02:00
parent cb243eea6d
commit ab44996ce9
2 changed files with 62 additions and 59 deletions

View File

@@ -1,57 +1,60 @@
## The WirePlumber access configuration ## The WirePlumber access configuration
access.rules = [ access.rules = [
# The list of access rules # The list of access rules
# The following are the default rules applied if none overrides them. # The following are the default rules applied if none overrides them.
{ # {
matches = [ # matches = [
{ # {
access = "flatpak" # access = "flatpak"
media.category = "Manager" # media.category = "Manager"
} # }
] # ]
actions = { # actions = {
update-props = { # update-props = {
access = "flatpak-manager" # access = "flatpak-manager"
default_permissions = "all", # default_permissions = "all",
} # }
} # }
} # }
{
matches = [ # {
{ # matches = [
access = "flatpak" # {
} # access = "flatpak"
] # }
actions = { # ]
update-props = { # actions = {
default_permissions = "rx" # update-props = {
} # default_permissions = "rx"
} # }
} # }
{ # }
matches = [
{ # {
access = "restricted" # matches = [
} # {
] # access = "restricted"
actions = { # }
update-props = { # ]
default_permissions = "rx" # actions = {
} # update-props = {
} # default_permissions = "rx"
} # }
{ # }
matches = [ # }
{
access = "default" # {
} # matches = [
] # {
actions = { # access = "default"
update-props = { # }
default_permissions = "all" # ]
} # actions = {
} # update-props = {
} # default_permissions = "all"
] # }
# }
# }
]

View File

@@ -32,14 +32,14 @@ function getDefaultPermissions (properties)
local media_category = properties["media.category"] local media_category = properties["media.category"]
if access == "flatpak" and media_category == "Manager" then if access == "flatpak" and media_category == "Manager" then
return "all" return "all", "flatpak-manager"
elseif access == "flatpak" or access == "restricted" then elseif access == "flatpak" or access == "restricted" then
return "rx" return "rx", access
elseif access == "default" then elseif access == "default" then
return "all" return "all", access
end end
return nil return nil, nil
end end
function getPermissions (properties) function getPermissions (properties)
@@ -66,7 +66,7 @@ clients_om:connect("object-added", function (om, client)
local perms, effective_access = getPermissions (properties) local perms, effective_access = getPermissions (properties)
if perms == nil then if perms == nil then
perms = getDefaultPermissions (properties) perms, effective_access = getDefaultPermissions (properties)
end end
if effective_access == nil then if effective_access == nil then
effective_access = access effective_access = access