From 411802ec2f654bb5ed1126c307575b81e2361c6b Mon Sep 17 00:00:00 2001 From: NGPixel Date: Sun, 20 Feb 2022 18:46:03 -0500 Subject: [PATCH] fix: check update page access using original page path --- server/models/pages.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/server/models/pages.js b/server/models/pages.js index cd786374..5d941bc5 100644 --- a/server/models/pages.js +++ b/server/models/pages.js @@ -371,8 +371,8 @@ module.exports = class Page extends Model { // -> Check for page access if (!WIKI.auth.checkAccess(opts.user, ['write:pages'], { - locale: opts.locale, - path: opts.path + locale: ogPage.localeCode, + path: ogPage.path })) { throw new WIKI.Error.PageUpdateForbidden() } @@ -456,6 +456,14 @@ module.exports = class Page extends Model { // -> Perform move? if ((opts.locale && opts.locale !== page.localeCode) || (opts.path && opts.path !== page.path)) { + // -> Check target path access + if (!WIKI.auth.checkAccess(opts.user, ['write:pages'], { + locale: opts.locale, + path: opts.path + })) { + throw new WIKI.Error.PageMoveForbidden() + } + await WIKI.models.pages.movePage({ id: page.id, destinationLocale: opts.locale,