Skip to content

Clarification of comments versus code on _allow_create #3

@hughlomas

Description

@hughlomas

This may simply be me not understanding something here, so mainly I am requesting a clarification.

On lines 171-186 where _allow_create is commented and defined

/**
   * A convenience method for declaring access control on creates, based on the
   * value of the document before the operation is applied to it.
   * @param {String} collectionName
   * @param {Function} callback(docId, opData, doc, connectSession, next)
   *   where next(docId, opData, docBeforeOp, session, next)
   */
  Store.prototype._allow_create = function (pattern, validate) {
    this.shareClient._validatorsCreate.push(
      function (collection, docName, opData, snapshotData, connectSession) {
        if (! collectionMatchesPattern(collection, pattern)) return;
        var newDoc = opData.create.data;
        return validate(docName, newDoc, connectSession);
      }
    );
  };

Is the @param {Function} callback(docId, opData, doc, connectSession, next) in the comments supposed to correlate to validate(docName, newDoc, connectSession) in the code?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions