use user specified permission.

User settings should override default behavior.
This commit is contained in:
handsome0hell 2020-03-07 21:08:35 +08:00 committed by Emmanuel Lepage Vallee
parent 0dfa5930b6
commit e5b12877b9
2 changed files with 5 additions and 5 deletions

View File

@ -20,10 +20,6 @@ local default_permissions = {
} }
function module.check(object, class, request, context) function module.check(object, class, request, context)
if not default_permissions[class] then return true end
if not default_permissions[class][request] then return true end
if default_permissions[class][request][context] == nil then return true end
local ret = nil local ret = nil
if object._private.permissions and object._private.permissions[request] then if object._private.permissions and object._private.permissions[request] then
@ -32,6 +28,10 @@ function module.check(object, class, request, context)
if ret ~= nil then return ret end if ret ~= nil then return ret end
if not default_permissions[class] then return true end
if not default_permissions[class][request] then return true end
if default_permissions[class][request][context] == nil then return true end
return default_permissions[class][request][context] return default_permissions[class][request][context]
end end

View File

@ -26,7 +26,7 @@ describe("awful.permissions.client_geometry_requests", function()
local permissions = require("awful.permissions") local permissions = require("awful.permissions")
it("removes x/y/width/height when immobilized", function() it("removes x/y/width/height when immobilized", function()
local c = {} local c = {_private={}}
local s = stub.new(c, "geometry") local s = stub.new(c, "geometry")
permissions.client_geometry_requests(c, "ewmh", {}) permissions.client_geometry_requests(c, "ewmh", {})