-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stub implementation for generic trust monitors
- Loading branch information
Showing
2 changed files
with
18 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
'convex.trust.monitors | ||
|
||
(import convex.trust :as trust) | ||
|
||
;; Generic check | ||
(defn check-trusted? | ||
^:callable? | ||
[subject action object] | ||
(or *scope* (fail :ARGUMENT "Null scope in generic trust monitor")) | ||
(let [[type arg] *scope*] | ||
(cond | ||
(= :wl type) (contains? arg subject) | ||
(= :and type) (reduce (fn [a b] (and a (trust/trusted? b subject action object))) true arg) | ||
(= :or type) (reduce (fn [a b] (or a (trust/trusted? b subject action object))) false arg) | ||
(address? type) (call *scope* (check-trusted? subject action object)) | ||
false | ||
))) |
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