Class: Parse::Constraint::NotReadableByConstraint
- Inherits:
-
Parse::Constraint
- Object
- Parse::Constraint
- Parse::Constraint::NotReadableByConstraint
- Includes:
- AclConstraintHelpers
- Defined in:
- lib/parse/query/constraints.rb
Overview
Note:
This constraint uses aggregation pipeline because Parse Server restricts direct queries on the internal _rperm field.
ACL NOT Readable By Constraint Query objects that are NOT readable by the specified users/roles. Useful for finding objects hidden from specific users.
Instance Attribute Summary
Attributes inherited from Parse::Constraint
#operand, #operation, #operator, #value
Instance Method Summary collapse
Methods inherited from Parse::Constraint
#as_json, constraint_keyword, create, formatted_value, #formatted_value, #initialize, #key, #precedence, register, #to_s
Constructor Details
This class inherits a constructor from Parse::Constraint
Instance Method Details
#build ⇒ Object
3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 |
# File 'lib/parse/query/constraints.rb', line 3169 def build keys = normalize_acl_keys(@value) return { "__aggregation_pipeline" => [] } if keys.empty? # Find objects where _rperm does NOT contain any of the keys pipeline = [ { "$match" => { "_rperm" => { "$nin" => keys }, }, }, ] { "__aggregation_pipeline" => pipeline } end |