Browse Source
fix: apply locale restrictions to page rules
pull/5044/head
v2.5.276
NGPixel
2 years ago
No known key found for this signature in database
GPG Key ID: 8FDA2F1757F60D63
1 changed files with
3 additions and
0 deletions
-
server/core/auth.js
|
@ -241,6 +241,9 @@ module.exports = { |
|
|
user.groups.forEach(grp => { |
|
|
user.groups.forEach(grp => { |
|
|
const grpId = _.isObject(grp) ? _.get(grp, 'id', 0) : grp |
|
|
const grpId = _.isObject(grp) ? _.get(grp, 'id', 0) : grp |
|
|
_.get(WIKI.auth.groups, `${grpId}.pageRules`, []).forEach(rule => { |
|
|
_.get(WIKI.auth.groups, `${grpId}.pageRules`, []).forEach(rule => { |
|
|
|
|
|
if (rule.locales && rule.locales.length > 0) { |
|
|
|
|
|
if (!rule.locales.includes(page.locale)) { return } |
|
|
|
|
|
} |
|
|
if (_.intersection(rule.roles, permissions).length > 0) { |
|
|
if (_.intersection(rule.roles, permissions).length > 0) { |
|
|
switch (rule.match) { |
|
|
switch (rule.match) { |
|
|
case 'START': |
|
|
case 'START': |
|
|