Check for user access in ldap ftp routes

This commit is contained in:
Johannes Zellner
2019-03-19 16:23:03 -07:00
parent 62ee3fa0f1
commit 4a046ca70e
2 changed files with 35 additions and 20 deletions

View File

@@ -10,6 +10,7 @@ exports = module.exports = {
get: get,
getByContainerId: getByContainerId,
getByIpAddress: getByIpAddress,
getByFqdn: getByFqdn,
getAll: getAll,
getAllByUser: getAllByUser,
install: install,
@@ -477,6 +478,20 @@ function getByIpAddress(ip, callback) {
});
}
function getByFqdn(fqdn, callback) {
assert.strictEqual(typeof fqdn, 'string');
assert.strictEqual(typeof callback, 'function');
getAll(function (error, result) {
if (error) return callback(error);
var app = result.find(function (a) { return a.fqdn === fqdn; });
if (!app) return callback(new AppsError(AppsError.NOT_FOUND, 'No such app'));
callback(null, app);
});
}
function getAll(callback) {
assert.strictEqual(typeof callback, 'function');