Implements bitmap-based limited privileges for non-admins

Implements #4489
This commit is contained in:
Simone Mainardi 2020-10-09 15:50:22 +02:00
parent a64095f244
commit 049bfdcf4a
26 changed files with 180 additions and 36 deletions

View file

@ -16,7 +16,7 @@ local pool_import_export = require "pool_import_export"
local json = require "dkjson"
local rest_utils = require "rest_utils"
local import_export_rest_utils = require "import_export_rest_utils"
local auth = require "auth"
--
-- Reset Pool configuration
-- Example: curl -u admin:admin http://localhost:3000/lua/rest/v1/reset/pool/config.lua
@ -24,7 +24,7 @@ local import_export_rest_utils = require "import_export_rest_utils"
-- NOTE: in case of invalid login, no error is returned but redirected to login
--
if not haveAdminPrivileges() then
if not auth.has_capability(auth.capabilities.pools) then
rest_utils.answer(rest_utils.consts.err.not_granted)
return
end