Class: Parse::Constraint::ACLWritableByRoleConstraint
- Inherits:
-
Parse::Constraint
- Object
- Parse::Constraint
- Parse::Constraint::ACLWritableByRoleConstraint
- Defined in:
- lib/parse/query/constraints.rb
Overview
A constraint for filtering objects writable by specific role names. Automatically adds "role:" prefix to role names.
# Find objects writable by Admin role (string - adds role: prefix) Post.where(:ACL.writable_by_role => "Admin")
# Find objects writable by Role object Post.where(:ACL.writable_by_role => admin_role)
# Find objects writable by multiple roles Post.where(:ACL.writable_by_role => ["Admin", "Moderator"])
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Parse::Constraint
#operand, #operation, #operator, #value
Instance Method Summary collapse
-
#build ⇒ Hash
The compiled constraint using _wperm field.
-
#strict? ⇒ Boolean
Whether to compile an EXACT match.
- #writable_by_role ⇒ ACLWritableByRoleConstraint
Methods inherited from Parse::Constraint
#as_json, constraint_keyword, create, formatted_value, #formatted_value, #initialize, #key, #precedence, #regex_unicode_option, register, #to_s
Constructor Details
This class inherits a constructor from Parse::Constraint
Instance Method Details
#build ⇒ Hash
Returns the compiled constraint using _wperm field.
2990 2991 2992 2993 |
# File 'lib/parse/query/constraints.rb', line 2990 def build = ACLPermissions.collect_role_only(@value) ACLPermissions.pipeline(, field: "_wperm", strict: strict?) end |
#strict? ⇒ Boolean
Returns whether to compile an EXACT match. Overridden by Parse::Constraint::ACLWritableByRoleExactConstraint.
2985 2986 2987 |
# File 'lib/parse/query/constraints.rb', line 2985 def strict? false end |
#writable_by_role ⇒ ACLWritableByRoleConstraint
2981 |
# File 'lib/parse/query/constraints.rb', line 2981 register :writable_by_role |