Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarification of comments versus code on _allow_create #3

Open
hughlomas opened this issue Oct 9, 2013 · 0 comments
Open

Clarification of comments versus code on _allow_create #3

hughlomas opened this issue Oct 9, 2013 · 0 comments

Comments

@hughlomas
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant