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
access.rules = [
# The list of access rules
access.rules = [
# The list of access rules
# The following are the default rules applied if none overrides them.
{
matches = [
{
access = "flatpak"
media.category = "Manager"
}
]
actions = {
update-props = {
access = "flatpak-manager"
default_permissions = "all",
}
}
}
{
matches = [
{
access = "flatpak"
}
]
actions = {
update-props = {
default_permissions = "rx"
}
}
}
{
matches = [
{
access = "restricted"
}
]
actions = {
update-props = {
default_permissions = "rx"
}
}
}
{
matches = [
{
access = "default"
}
]
actions = {
update-props = {
default_permissions = "all"
}
}
}
]
# The following are the default rules applied if none overrides them.
# {
# matches = [
# {
# access = "flatpak"
# media.category = "Manager"
# }
# ]
# actions = {
# update-props = {
# access = "flatpak-manager"
# default_permissions = "all",
# }
# }
# }
# {
# matches = [
# {
# access = "flatpak"
# }
# ]
# actions = {
# update-props = {
# default_permissions = "rx"
# }
# }
# }
# {
# matches = [
# {
# access = "restricted"
# }
# ]
# actions = {
# update-props = {
# default_permissions = "rx"
# }
# }
# }
# {
# matches = [
# {
# access = "default"
# }
# ]
# actions = {
# update-props = {
# default_permissions = "all"
# }
# }
# }
]

View File

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