Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add parameters at functions' declare #82

Merged
merged 2 commits into from
Jul 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/persist/Adapter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,22 @@ function loadPolicyLine(line, model)
if line == "" then
return
end

if line:sub(1,1) == "#" then
return
end

local tokens = Util.split(line, ",")
local key = tokens[1]
local sec = key:sub(1,1)

if model.model[sec] == nil then
return
end
if model.model[sec][key] == nil then
return
end

model.model[sec][key].policy = model.model[sec][key].policy or {}
local rules = {}
for i = 2, #tokens do
Expand All @@ -52,7 +52,7 @@ Adapter.__index = Adapter
*
* @param model the model.
]]
function Adapter:loadPolicy()
function Adapter:loadPolicy(model)

end

Expand All @@ -61,7 +61,7 @@ end
*
* @param model the model.
]]
function Adapter:savePolicy()
function Adapter:savePolicy(model)

end

Expand All @@ -73,7 +73,7 @@ end
* @param ptype the policy type, "p", "p2", .. or "g", "g2", ..
* @param rule the rule, like (sub, obj, act).
]]
function Adapter:addPolicy()
function Adapter:addPolicy(sec,ptype,rule)

end

Expand All @@ -85,7 +85,7 @@ end
* @param ptype the policy type, "p", "p2", .. or "g", "g2", ..
* @param rule the rule, like (sub, obj, act).
]]
function Adapter:removePolicy()
function Adapter:removePolicy(sec,ptype,rule)

end

Expand All @@ -99,7 +99,7 @@ end
* @param fieldValues the field values to be matched, value ""
* means not to match this field.
]]
function Adapter:removeFilteredPolicy()
function Adapter:removeFilteredPolicy(sec, ptype, fieldIndex, fieldValues)

end

Expand Down
8 changes: 7 additions & 1 deletion src/persist/file_adapter/FileAdapter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ function FileAdapter:addPolicy(sec, ptype, rule)
error("not implemented")
end

--[[
* addPolicies adds policy rules to the storage.
]]
function FileAdapter:addPolicies(sec, ptype, rules)
error("not implemented")
end
--[[
* removePolicy removes a policy rule from the storage.
]]
Expand All @@ -109,4 +115,4 @@ end
]]
function FileAdapter:removeFilteredPolicy(sec, ptype, fieldIndex, fieldValues)
error("not implemented")
end
end