More api documentation updates

This commit is contained in:
Nick O'Leary
2019-01-28 14:40:24 +00:00
parent 2e063f91bc
commit e0bb03a53f
7 changed files with 109 additions and 4 deletions

View File

@@ -14,6 +14,11 @@
* limitations under the License.
**/
/**
* @mixin @node-red/editor-api_auth
*/
var passport = require("passport");
var oauth2orize = require("oauth2orize");
@@ -44,7 +49,14 @@ function init(_settings,storage) {
Tokens.init(mergedAdminAuth,storage);
}
}
/**
* Returns an Express middleware function that ensures the user making a request
* has the necessary permission.
*
* @param {String} permission - the permission required for the request, such as `flows.write`
* @return {Function} - an Express middleware
* @memberof @node-red/editor-api_auth
*/
function needsPermission(permission) {
return function(req,res,next) {
if (settings && settings.adminAuth) {