fix: support permissions by tags for basic db search engine (#2416)

This code will allow the "search" component to correctly filter pages by usergroup permissions based on tags instead of paths

Co-authored-by: Riccardo Re <riccardo.re@clevermind.cloud>
This commit is contained in:
Riccardo Re
2020-09-13 19:53:31 +02:00
committed by GitHub
parent 2d52ba3303
commit 660b78d9e2
2 changed files with 7 additions and 2 deletions

View File

@@ -21,7 +21,11 @@ module.exports = {
*/
async query(q, opts) {
const results = await WIKI.models.pages.query()
.column('id', 'title', 'description', 'path', 'localeCode as locale')
.column('pages.id', 'title', 'description', 'path', 'localeCode as locale')
.withGraphJoined('tags') // Adding page tags since they can be used to check resource access permissions
.modifyGraph('tags', builder => {
builder.select('tag')
})
.where(builder => {
builder.where('isPublished', true)
if (opts.locale) {