Added 'restrictions' list in config to limit album access
Signed-off-by: James Ketrenos <james_git@ketrenos.com>
This commit is contained in:
parent
e9fd50a054
commit
979c2387e1
@ -90,6 +90,21 @@ app.use(basePath, function(req, res, next) {
|
||||
if (!req.session || !req.session.user || !req.session.user.username) {
|
||||
return res.status(401).send("Unauthorized");
|
||||
}
|
||||
|
||||
if (config.has("restrictions")) {
|
||||
let allowed = config.get("restrictions");
|
||||
if (!Array.isArray(allowed)) {
|
||||
allowed = [ allowed ];
|
||||
}
|
||||
for (let i = 0; i < allowed.length; i++) {
|
||||
if (allowed[i] == req.session.user.username) {
|
||||
return next();
|
||||
}
|
||||
}
|
||||
console.log("Unauthorized (logged in) access by user: " + req.session.user.username);
|
||||
return res.status(401).send("Unauthorized");
|
||||
}
|
||||
|
||||
return next();
|
||||
});
|
||||
|
||||
|
@ -194,7 +194,6 @@ const mkdir = function (_path) {
|
||||
}
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
console.log("mkdir " + path);
|
||||
fs.mkdir(path, function (error) {
|
||||
if (error) {
|
||||
return reject(error);
|
||||
|
Loading…
x
Reference in New Issue
Block a user