lib/parse/model/acl.rb
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
      permission = ACL.permission(read, write)
      # if the input is already an Permission object, then set it directly
      permission = read if read.is_a?(Parse::ACL::Permission)
      if permission.is_a?(ACL::Permission)
        if permissions[id.to_s] != permission
          will_change! # dirty track
          permissions[id.to_s] = permission
        end
      end

      permissions
    end
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
      permission = ACL.permission(read, write)
      # if the input is already an Permission object, then set it directly
      permission = read if read.is_a?(Parse::ACL::Permission)
      if permission.is_a?(ACL::Permission)
        if permissions[id.to_s] != permission
          will_change! # dirty track
          permissions[id.to_s] = permission
        end
      end

      permissions
    end
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 permission = ACL . permission ( read , write ) # if the input is already an Permission object, then set it directly permission = read if read . is_a? ( Parse :: ACL :: Permission ) if permission . is_a? ( ACL :: Permission ) if permissions [ id . to_s ] != permission will_change! # dirty track permissions [ id . to_s ] = permission end end permissions end
Apply a new permission with a given objectId, tag or :public.
 @overload apply(user, read = nil, write = nil)
  Set the read and write permissions for this user on this ACL.
  @param user [Parse::User] the user object.
  @param read [Boolean] the read permission.
  @param write [Boolean] the write permission.
 @overload apply(role, read = nil, write = nil)
  Set the read and write permissions for this role object on this ACL.
  @param role [Parse::Role] the role object.
  @param read [Boolean] the read permission.
  @param write [Boolean] the write permission.
 @overload apply(id, read = nil, write = nil)
  Set the read and write permissions for this objectId on this ACL.
  @param id [String|:public] the objectId for a {Parse::User}. If :public is passed,
      then the {Parse::ACL::PUBLIC} read and write permissions will be modified.
  @param read [Boolean] the read permission.
  @param write [Boolean] the write permission.
 @return [Hash] the current set of permissions.
 @see #apply_role
Apply a new permission with a given objectId tag or : public .