1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Allow user.default to be an api function

This commit is contained in:
Nick O'Leary 2015-02-05 10:45:03 +00:00
parent 53a515176b
commit 26c42e500f

View File

@ -23,16 +23,18 @@ var util = require("util");
users: [{
username: "nol",
password: "5f4dcc3b5aa765d61d8327deb882cf99" // password
permissions: "* read write"
}],
default: {}
default: {
permissions: "* read write"
}
},
adminAuth: {
type: "credentials",
api: {
get: function(username) {}
authenticate: function(username,password) {}
default: function() {}
users: function(username) {return when.resolve(user)},
authenticate: function(username,password) { return when.resolve(user);}
default: function() { return when.resolve(defaultUser) }
}
*/
@ -95,12 +97,16 @@ function init(config) {
}
}
if (config.default) {
if (typeof config.default === "function") {
api.default = config.default;
} else {
api.default = function() {
return when.resolve({
"anonymous": true,
"permissions":config.default.permissions
});
}
}
} else {
api.default = getDefaultUser;
}