Method: Parse::ACL#apply
- Defined in:
- lib/parse/model/acl.rb
#apply(user, read = nil, write = nil) ⇒ Hash #apply(role, read = nil, write = nil) ⇒ Hash #apply(id, read = nil, write = nil) ⇒ Hash Also known as: add
Apply a new permission with a given objectId, tag or :public.
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 |
# File 'lib/parse/model/acl.rb', line 238 def apply(id, read = nil, write = nil) return apply_role(id,read,write) if id.is_a?(Parse::Role) id = id.id if id.is_a?(Parse::Pointer) unless id.present? raise ArgumentError, "Invalid argument applying ACLs: must be either objectId, role or :public" end id = PUBLIC if id.to_sym == :public # create a new Permissions = ACL.(read, write) # if the input is already an Permission object, then set it directly = read if read.is_a?(Parse::ACL::Permission) if .is_a?(ACL::Permission) if [id.to_s] != will_change! # dirty track [id.to_s] = end end end |