Add runtime option for disabling permission checks

This commit is contained in:
Tobie Morgan Hitchcock 2022-04-01 10:39:19 +01:00
parent 1ea692d32e
commit 41c44ea709

View file

@ -25,6 +25,8 @@ pub struct Options {
pub debug: bool,
// Should we force tables/events to re-run?
pub force: bool,
// Should we run permissions checks?
pub perms: bool,
// Should we process field queries?
pub fields: bool,
// Should we process event queries?
@ -48,6 +50,7 @@ impl Options {
ns: None,
db: None,
dive: 0,
perms: true,
debug: false,
force: false,
fields: true,
@ -107,6 +110,17 @@ impl Options {
}
}
// Create a new Options object for a subquery
pub fn perms(&self, v: bool) -> Options {
Options {
auth: self.auth.clone(),
ns: self.ns.clone(),
db: self.db.clone(),
perms: v,
..*self
}
}
// Create a new Options object for a subquery
pub fn fields(&self, v: bool) -> Options {
Options {