File tree Expand file tree Collapse file tree 3 files changed +19
-25
lines changed Expand file tree Collapse file tree 3 files changed +19
-25
lines changed Original file line number Diff line number Diff line change 425
425
{:keys [data rule-params new-data linked-data linked-etype]}]
426
426
(try
427
427
(let [bindings (HashMap. )
428
-
429
428
_ (.put bindings " auth" (AuthCelMap. ctx (CelMap. (:current-user ctx))))
430
429
_ (.put bindings " data" (DataCelMap. ctx etype (CelMap. data)))
431
430
_ (.put bindings " ruleParams" (CelMap. rule-params))
432
431
_ (when new-data
433
- (.put bindings " newData" (DataCelMap. ctx etype ( CelMap. new-data) )))
432
+ (.put bindings " newData" (CelMap. new-data)))
434
433
_ (when linked-data
435
434
(.put bindings " linkedData" (DataCelMap. ctx linked-etype (CelMap. linked-data))))
436
435
result (.eval ^CelRuntime$Program cel-program
480
479
(CelMap. rule-params))
481
480
" newData" (if new-data
482
481
(Optional/of
483
- (DataCelMap. ctx etype ( CelMap. new-data) ))
482
+ (CelMap. new-data))
484
483
(Optional/empty ))
485
484
" linkedData" (if linked-data
486
485
(Optional/of
Original file line number Diff line number Diff line change 119
119
ref-k (assoc! ref-k 1 ))
120
120
(cms/add-batch sketch (persistent! triples))
121
121
(cms/add-batch reverse-sketch (persistent! reverse-triples))
122
- (+ triples-pg-size (:pg-size triple)))
122
+ (+ triples-pg-size (long ( :pg-size triple) )))
123
123
(recur (rest s)
124
124
app-id
125
125
attr-id
128
128
ref-k (assoc! ref-k (inc (get reverse-triples ref-k 0 ))))
129
129
sketch
130
130
reverse-sketch
131
- (+ triples-pg-size (:pg-size triple)))))
131
+ (+ triples-pg-size (long ( :pg-size triple) )))))
132
132
(let [forward-sketch (cms/add-batch sketch (persistent! triples))
133
133
reverse-sketch (cms/add-batch reverse-sketch (persistent! reverse-triples))]
134
134
(vswap! sketch-count inc)
Original file line number Diff line number Diff line change 1693
1693
(map :handle )
1694
1694
set))))
1695
1695
1696
- (testing " ref works"
1697
- (test-util/test-matrix
1698
- [perm [" handle in data.ref('users.handle')"
1699
- " handle in newData.ref('users.handle')" ]]
1700
-
1701
- (rule-model/put!
1702
- (aurora/conn-pool :write )
1703
- {:app-id app-id :code {:bookshelves {:allow {:update perm}
1704
- :bind [" handle" " 'alex'" ]}}})
1705
- (permissioned-tx/transact!
1706
- (make-ctx )
1707
- [[:add-triple (resolvers/->uuid r " eid-short-stories" ) (resolvers/->uuid r :bookshelves/name ) " Long Stories" ]])
1708
- (is
1709
- (= #{" Long Stories" " Nonfiction" }
1710
- (->> (test-util/pretty-perm-q
1711
- {:app-id app-id :current-user nil }
1712
- {:bookshelves {:$ {:where {:users.handle " alex" }}}})
1713
- :bookshelves
1714
- (map :name )
1715
- set)))))
1696
+ (rule-model/put!
1697
+ (aurora/conn-pool :write )
1698
+ {:app-id app-id :code {:bookshelves {:allow {:update " handle in data.ref('users.handle')" }
1699
+ :bind [" handle" " 'alex'" ]}}})
1700
+ (permissioned-tx/transact!
1701
+ (make-ctx )
1702
+ [[:add-triple (resolvers/->uuid r " eid-short-stories" ) (resolvers/->uuid r :bookshelves/name ) " Long Stories" ]])
1703
+ (is
1704
+ (= #{" Long Stories" " Nonfiction" }
1705
+ (->> (test-util/pretty-perm-q
1706
+ {:app-id app-id :current-user nil }
1707
+ {:bookshelves {:$ {:where {:users.handle " alex" }}}})
1708
+ :bookshelves
1709
+ (map :name )
1710
+ set)))
1716
1711
1717
1712
(testing " invalid ref blocks"
1718
1713
(rule-model/put!
You can’t perform that action at this time.
0 commit comments