From 30827382e297b3a51957354bfa03ef64782b6013 Mon Sep 17 00:00:00 2001 From: mikera Date: Fri, 15 Dec 2023 00:06:57 +0000 Subject: [PATCH] Edits to Trust Monitors code --- convex-core/src/main/cvx/convex/trust/monitors.cvx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/convex-core/src/main/cvx/convex/trust/monitors.cvx b/convex-core/src/main/cvx/convex/trust/monitors.cvx index fa1ccd916..4f29057e7 100644 --- a/convex-core/src/main/cvx/convex/trust/monitors.cvx +++ b/convex-core/src/main/cvx/convex/trust/monitors.cvx @@ -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)) @@ -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)]]]) @@ -43,4 +47,8 @@ (defn rule [func] [~*address* [:rule func]]) + +(defn owns [asset] + [ownership asset]) + \ No newline at end of file