mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 07:56:16 -04:00
import: setting for allowing import without author existing
This commit is contained in:
parent
9fdb9e224c
commit
bfca481b0b
5 changed files with 32 additions and 4 deletions
|
@ -83,20 +83,20 @@ exports.expressCreateServer = function (hook_name, args, cb) {
|
|||
|
||||
let author = await authorManager.getAuthor4Token(req.cookies.token);
|
||||
// author is of the form: "a.g2droBYw1prY7HW9"
|
||||
if (!author) {
|
||||
if (!author && !settings.allowAnyoneToImport) {
|
||||
console.warn(`Unable to import file into "${req.params.pad}". No Author found for token ${req.cookies.token}`);
|
||||
|
||||
return next();
|
||||
}
|
||||
|
||||
let authorsPads = await authorManager.listPadsOfAuthor(author);
|
||||
if (!authorsPads) {
|
||||
if (!authorsPads && !settings.allowAnyoneToImport) {
|
||||
console.warn(`Unable to import file into "${req.params.pad}". Author "${author}" exists but he never contributed to any pad`);
|
||||
return next();
|
||||
}
|
||||
|
||||
let authorsPadIDs = authorsPads.padIDs;
|
||||
if (authorsPadIDs.indexOf(req.params.pad) === -1) {
|
||||
if ( (authorsPadIDs.indexOf(req.params.pad) === -1) && !settings.allowAnyoneToImport) {
|
||||
console.warn(`Unable to import file into "${req.params.pad}". Author "${author}" exists but he never contributed to this pad`);
|
||||
return next();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue