Class: Parse::Constraint::ACLReadableByRoleConstraint
- Inherits:
-
Parse::Constraint
- Object
- Parse::Constraint
- Parse::Constraint::ACLReadableByRoleConstraint
- Defined in:
- lib/parse/query/constraints.rb
Overview
A constraint for filtering objects readable by specific role names. Automatically adds “role:” prefix to role names.
# Find objects readable by Admin role (string - adds role: prefix)
Post.where(:ACL.readable_by_role => "Admin")
# Find objects readable by Role object
Post.where(:ACL.readable_by_role => admin_role)
# Find objects readable by multiple roles
Post.where(:ACL.readable_by_role => ["Admin", "Moderator"])
Instance Attribute Summary
Attributes inherited from Parse::Constraint
#operand, #operation, #operator, #value
Instance Method Summary collapse
-
#build ⇒ Hash
The compiled constraint using _rperm field.
- #readable_by_role ⇒ ACLReadableByRoleConstraint
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 ⇒ Hash
Returns the compiled constraint using _rperm field.
2721 2722 2723 2724 |
# File 'lib/parse/query/constraints.rb', line 2721 def build = ACLPermissions.collect_role_only(@value) ACLPermissions.pipeline(, field: "_rperm") end |
#readable_by_role ⇒ ACLReadableByRoleConstraint
2718 |
# File 'lib/parse/query/constraints.rb', line 2718 register :readable_by_role |