Skip to content

Commit

Permalink
Edits to Trust Monitors code
Browse files Browse the repository at this point in the history
  • Loading branch information
mikera committed Dec 15, 2023
1 parent f6a4990 commit 3082738
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions convex-core/src/main/cvx/convex/trust/monitors.cvx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
(let [[type arg] *scope*]
(cond
(= :wl type) (contains-key? arg subject)
(= :actions type) (contains-key? arg action)
(= :all type) (reduce (fn [a b] (and a (trust/trusted? b subject action object))) true arg)
(= :any type) (reduce (fn [a b] (or a (trust/trusted? b subject action object))) false arg)
(= :not type) (not (trust/trusted? arg subject action object))
Expand All @@ -23,14 +24,17 @@
false
)))

(defn permit [addresses]
(defn permit-subjects [& addresses]
[wl (set addresses)])

(defn permit-actions [& actions]
[~*address* [:actions (set actions)]])

(defn any [& args]
[~*address* [:any (vec args)]])

(defn all [& args]
[~*address* [:all (vec args)]])
(defn all [arg & more]
[~*address* [:all (apply vector arg more)]])

(defn before [end]
[~*address* [:time [*timestamp* (int end)]]])
Expand All @@ -43,4 +47,8 @@

(defn rule [func]
[~*address* [:rule func]])

(defn owns [asset]
[ownership asset])


0 comments on commit 3082738

Please sign in to comment.