Skip to content

Commit

Permalink
More CNS refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
mikera committed Dec 21, 2023
1 parent 846d197 commit abd55a9
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions convex-core/src/main/cvx/convex/registry.cvx
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,12 @@
(or (string? pname) (fail :ARGUMENT "CNS path element must be a string"))
(or sm (error :STATE "CNS Node key not valid"))
(if-let [rec (get sm sym)]
(do ;; This is an existing record, so check record controller
(or (trust/trusted? (get rec 1) *caller* :update) (fail :TRUST "No permission to update CNS record"))
(set-in! cns-database [*scope* pname] [addr cont meta]))
(do ;; This is a new record, so check create permission TODO use per-node monitor?
(or (trust/trusted? (get cns-owners *scope*) *caller* :create pname) (fail :TRUST "No permission to create CNS record"))
)
)))
;; This is an existing record, so check record controller
(or (trust/trusted? (get rec 1) *caller* :update) (fail :TRUST "No permission to update CNS record"))
;; This is a new record, so check create permission TODO use per-node monitor?
(or (trust/trusted? (get cns-owners *scope*) *caller* :create pname) (fail :TRUST "No permission to create CNS record")))

;; update record since at this point all required checks have passed
(set-in! cns-database [*scope* pname] [addr cont meta])
))

0 comments on commit abd55a9

Please sign in to comment.