Unverified Commit 7d23344c authored by BobbyB's avatar BobbyB Committed by GitHub

fix: page rules role check (#1447)

* Check rule.roles against permissions * Added Role Check to EXACT matching * Code Review Fixes
parent a694d262
...@@ -173,6 +173,7 @@ module.exports = { ...@@ -173,6 +173,7 @@ 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(_.intersection(rule.roles, permissions).length > 0) {
switch (rule.match) { switch (rule.match) {
case 'START': case 'START':
if (_.startsWith(`/${page.path}`, `/${rule.path}`)) { if (_.startsWith(`/${page.path}`, `/${rule.path}`)) {
...@@ -207,6 +208,7 @@ module.exports = { ...@@ -207,6 +208,7 @@ module.exports = {
} }
break break
} }
}
}) })
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment