mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-13 06:34:39 -04:00
Add limited and protected permission
This commit is contained in:
parent
c21fb8e2a0
commit
89b8ddeaba
5 changed files with 43 additions and 16 deletions
|
@ -122,6 +122,11 @@ function checkViewPermission(req, note) {
|
|||
return false;
|
||||
else
|
||||
return true;
|
||||
} else if (note.permission == 'limited' || note.permission == 'protected') {
|
||||
if( !req.isAuthenticated() ) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
@ -161,7 +166,7 @@ function showNote(req, res, next) {
|
|||
findNote(req, res, function (note) {
|
||||
// force to use note id
|
||||
var noteId = req.params.noteId;
|
||||
var id = LZString.compressToBase64(note.id);
|
||||
var id = LZString.compressToBase64(note.id);
|
||||
if ((note.alias && noteId != note.alias) || (!note.alias && noteId != id))
|
||||
return res.redirect(config.serverurl + "/" + (note.alias || id));
|
||||
return responseHackMD(res, note);
|
||||
|
@ -413,7 +418,7 @@ function publishSlideActions(req, res, next) {
|
|||
res.redirect(config.serverurl + '/' + (note.alias ? note.alias : LZString.compressToBase64(note.id)));
|
||||
break;
|
||||
default:
|
||||
res.redirect(config.serverurl + '/p/' + note.shortid);
|
||||
res.redirect(config.serverurl + '/p/' + note.shortid);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue