Class: Parse::Constraint::ACLReadableByRoleConstraint
- Inherits:
-
Constraint
- Object
- 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"])
Direct Known Subclasses
Instance Method Summary collapse
-
#build ⇒ Hash
The compiled constraint using _rperm field.
- #readable_by_role ⇒ ACLReadableByRoleConstraint
-
#strict? ⇒ Boolean
Whether to compile an EXACT match.
Instance Method Details
#build ⇒ Hash
Returns the compiled constraint using _rperm field.
2894 2895 2896 2897 |
# File 'lib/parse/query/constraints.rb', line 2894 def build = ACLPermissions.collect_role_only(@value) ACLPermissions.pipeline(, field: "_rperm", strict: strict?) end |
#readable_by_role ⇒ ACLReadableByRoleConstraint
2885 |
# File 'lib/parse/query/constraints.rb', line 2885 register :readable_by_role |
#strict? ⇒ Boolean
Returns whether to compile an EXACT match. Overridden by Parse::Constraint::ACLReadableByRoleExactConstraint.
2889 2890 2891 |
# File 'lib/parse/query/constraints.rb', line 2889 def strict? false end |