Merge pull request #819 from marcelklehr/contributor-api-methods

Contributor api methods (listPadsOfAuthor & listAuthorsOfPad )
This commit is contained in:
John McLear 2012-06-27 11:31:25 -07:00
commit a717c11ab3
4 changed files with 132 additions and 2 deletions

View file

@ -47,6 +47,7 @@ exports.createGroupPad = groupManager.createGroupPad;
exports.createAuthor = authorManager.createAuthor;
exports.createAuthorIfNotExistsFor = authorManager.createAuthorIfNotExistsFor;
exports.listPadsOfAuthor = authorManager.listPadsOfAuthor;
/**********************/
/**SESSION FUNCTIONS***/
@ -481,6 +482,26 @@ exports.isPasswordProtected = function(padID, callback)
});
}
/**
listAuthorsOfPad(padID) returns an array of authors who contributed to this pad
Example returns:
{code: 0, message:"ok", data: {authorIDs : ["a.s8oes9dhwrvt0zif", "a.akf8finncvomlqva"]}
{code: 1, message:"padID does not exist", data: null}
*/
exports.listAuthorsOfPad = function(padID, callback)
{
//get the pad
getPadSafe(padID, true, function(err, pad)
{
if(ERR(err, callback)) return;
callback(null, {authorIDs: pad.getAllAuthors()});
});
}
/******************************/
/** INTERNAL HELPER FUNCTIONS */
/******************************/