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:
parent
53a515176b
commit
26c42e500f
@ -23,17 +23,19 @@ var util = require("util");
|
|||||||
users: [{
|
users: [{
|
||||||
username: "nol",
|
username: "nol",
|
||||||
password: "5f4dcc3b5aa765d61d8327deb882cf99" // password
|
password: "5f4dcc3b5aa765d61d8327deb882cf99" // password
|
||||||
|
permissions: "* read write"
|
||||||
}],
|
}],
|
||||||
default: {}
|
default: {
|
||||||
|
permissions: "* read write"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
adminAuth: {
|
adminAuth: {
|
||||||
type: "credentials",
|
type: "credentials",
|
||||||
api: {
|
users: function(username) {return when.resolve(user)},
|
||||||
get: function(username) {}
|
authenticate: function(username,password) { return when.resolve(user);}
|
||||||
authenticate: function(username,password) {}
|
default: function() { return when.resolve(defaultUser) }
|
||||||
default: function() {}
|
}
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//{username:"nick",password:crypto.createHash('md5').update("foo",'utf8').digest('hex')}
|
//{username:"nick",password:crypto.createHash('md5').update("foo",'utf8').digest('hex')}
|
||||||
@ -95,11 +97,15 @@ function init(config) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (config.default) {
|
if (config.default) {
|
||||||
api.default = function() {
|
if (typeof config.default === "function") {
|
||||||
return when.resolve({
|
api.default = config.default;
|
||||||
"anonymous": true,
|
} else {
|
||||||
"permissions":config.default.permissions
|
api.default = function() {
|
||||||
});
|
return when.resolve({
|
||||||
|
"anonymous": true,
|
||||||
|
"permissions":config.default.permissions
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
api.default = getDefaultUser;
|
api.default = getDefaultUser;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user