Add getOwner

This commit is contained in:
girish@cloudron.io
2016-01-13 12:28:38 -08:00
parent 5eb3c208f1
commit efaacdb534
3 changed files with 47 additions and 1 deletions

View File

@@ -17,7 +17,8 @@ exports = module.exports = {
setPassword: setPassword,
changePassword: changePassword,
update: updateUser,
createOwner: createOwner
createOwner: createOwner,
getOwner: getOwner
};
var assert = require('assert'),
@@ -382,3 +383,11 @@ function createOwner(username, password, email, callback) {
});
}
function getOwner(callback) {
userdb.getOwner(function (error, owner) {
if (error && error.reason === DatabaseError.NOT_FOUND) return callback(new UserError(UserError.NOT_FOUND));
if (error) return callback(new UserError(UserError.INTERNAL_ERROR, error));
return callback(null, owner);
});
}