Class: Parse::Constraint::NotWriteableByConstraint
- Inherits:
-
Constraint
- Object
- Constraint
- Parse::Constraint::NotWriteableByConstraint
- Defined in:
- lib/parse/query/constraints.rb
Overview
Note:
This constraint uses aggregation pipeline because Parse Server restricts direct queries on the internal _wperm field.
ACL NOT Writable By Constraint Query objects that are NOT writable by the specified users/roles.
Direct Known Subclasses
Instance Method Summary collapse
Instance Method Details
#build ⇒ Object
3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 |
# File 'lib/parse/query/constraints.rb', line 3266 def build keys = ACLPermissions.collect_for_negation(@value) return { "__aggregation_pipeline" => [] } if keys.empty? # See {NotReadableByConstraint#build}: the `$exists: true` guard # prevents a missing `_wperm` (publicly writable per Parse Server) # from matching `$nin`, which would otherwise make # #not_publicly_writable report write-exposed objects as safe. pipeline = [ { "$match" => { "_wperm" => { "$exists" => true, "$nin" => keys }, }, }, ] { "__aggregation_pipeline" => pipeline } end |