-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added logging, file logging and interfaces for watcher and disp…
…atcher (#54) * feat: Added logging for requests and file logging functionality Signed-off-by: Rushikesh Tote <[email protected]> * feat: Added enforceEx function and explain result functionality Signed-off-by: Rushikesh Tote <[email protected]> * feat: Added Dispatcher and Watcher interfaces with tests for it Signed-off-by: Rushikesh Tote <[email protected]> * fix: default result value in DefaultEffector and remove fileLogger Signed-off-by: Rushikesh Tote <[email protected]>
- Loading branch information
Showing
13 changed files
with
460 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--Copyright 2021 The casbin Authors. All Rights Reserved. | ||
-- | ||
--Licensed under the Apache License, Version 2.0 (the "License"); | ||
--you may not use this file except in compliance with the License. | ||
--You may obtain a copy of the License at | ||
-- | ||
-- http://www.apache.org/licenses/LICENSE-2.0 | ||
-- | ||
--Unless required by applicable law or agreed to in writing, software | ||
--distributed under the License is distributed on an "AS IS" BASIS, | ||
--WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
--See the License for the specific language governing permissions and | ||
--limitations under the License. | ||
|
||
-- Dispatcher is the interface for Casbin dispatcher | ||
Dispatcher = {} | ||
Dispatcher.__index = Dispatcher | ||
|
||
-- addPolicies adds policies rule to all instances. | ||
function Dispatcher:addPolicies(sec, ptype, rules) | ||
|
||
end | ||
|
||
-- removePolicies removes policies rule from all instances. | ||
function Dispatcher:removePolicies(sec, ptype, rules) | ||
|
||
end | ||
|
||
-- removeFilteredPolicies removes policy rules that match the filter from all instances. | ||
function Dispatcher:removeFilteredPolicies(sec, ptype, fieldIndex, ...) | ||
|
||
end | ||
|
||
-- clearPolicy clears all current policy in all instances. | ||
function Dispatcher:clearPolicy() | ||
|
||
end | ||
|
||
-- updatePolicy updates policy rule from all instances. | ||
function Dispatcher:updatePolicy(sec, ptype, oldRule, newRule) | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--Copyright 2021 The casbin Authors. All Rights Reserved. | ||
-- | ||
--Licensed under the Apache License, Version 2.0 (the "License"); | ||
--you may not use this file except in compliance with the License. | ||
--You may obtain a copy of the License at | ||
-- | ||
-- http://www.apache.org/licenses/LICENSE-2.0 | ||
-- | ||
--Unless required by applicable law or agreed to in writing, software | ||
--distributed under the License is distributed on an "AS IS" BASIS, | ||
--WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
--See the License for the specific language governing permissions and | ||
--limitations under the License. | ||
|
||
Watcher = {} | ||
Watcher.__index = Watcher | ||
|
||
-- setUpdateCallback sets the callback function that the watcher will call | ||
-- when the policy in DB has been changed by other instances. | ||
-- A classic callback is Enforcer:loadPolicy(). | ||
function Watcher:setUpdateCallback(func) | ||
|
||
end | ||
|
||
-- update calls the update callback of other instances to synchronize their policy. | ||
-- It is usually called after changing the policy in DB, like Enforcer:savePolicy(), | ||
-- Enforcer:AddPolicy(), Enforcer:RemovePolicy(), etc. | ||
function Watcher:update() | ||
|
||
end | ||
|
||
-- close stops and releases the watcher, the callback function will not be called any more. | ||
function Watcher:close() | ||
|
||
end |
Oops, something went wrong.