From 1e93c0f30426093828c5443fb373ca1a07423005 Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Sun, 12 Feb 2023 11:48:11 +0000 Subject: [PATCH] Ensure permissions are not chekced on PERMISSIONS clauses Closes #1633 --- lib/src/doc/allow.rs | 2 +- lib/src/doc/field.rs | 2 ++ lib/src/doc/pluck.rs | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/src/doc/allow.rs b/lib/src/doc/allow.rs index 264a4f31..9ae93346 100644 --- a/lib/src/doc/allow.rs +++ b/lib/src/doc/allow.rs @@ -33,7 +33,7 @@ impl<'a> Document<'a> { Permission::None => return Err(Error::Ignore), Permission::Full => return Ok(()), Permission::Specific(e) => { - // Ensure permissions are disabled + // Disable permissions let opt = &opt.perms(false); // Process the PERMISSION clause if !e.compute(ctx, opt, txn, Some(&self.current)).await?.is_truthy() { diff --git a/lib/src/doc/field.rs b/lib/src/doc/field.rs index 5309a85a..fdc5a771 100644 --- a/lib/src/doc/field.rs +++ b/lib/src/doc/field.rs @@ -77,6 +77,8 @@ impl<'a> Document<'a> { Permission::Full => (), Permission::None => val = old, Permission::Specific(e) => { + // Disable permissions + let opt = &opt.perms(false); // Configure the context let mut ctx = Context::new(ctx); ctx.add_value("value".into(), &val); diff --git a/lib/src/doc/pluck.rs b/lib/src/doc/pluck.rs index b6b4b851..9759b547 100644 --- a/lib/src/doc/pluck.rs +++ b/lib/src/doc/pluck.rs @@ -62,6 +62,8 @@ impl<'a> Document<'a> { Permission::Full => (), Permission::None => out.del(ctx, opt, txn, k).await?, Permission::Specific(e) => { + // Disable permissions + let opt = &opt.perms(false); // Get the current value let val = self.current.pick(k); // Configure the context