dh_demo

DreamHanks demo project
git clone git://git.lair.cx/dh_demo
Log | Files | Refs | README

commit b3b2aa5e630858671c6b53abbb5957dff68fd43c
parent 42f1e1c11be5f4be7eb64dc5a74e198766330514
Author: Yongbin Kim <iam@yongbin.kim>
Date:   Sun, 29 Jan 2023 14:26:22 +0900

fix(acl): getWikiAndPageACLViaPath 쿼리가 페이지가 없을 때 null을 리턴하던 문제 수정
Signed-off-by: Yongbin Kim <iam@yongbin.kim>

Signed-off-by: Yongbin Kim <iam@yongbin.kim>

Diffstat:
Mlib/models/wiki_acl.ts | 12++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/lib/models/wiki_acl.ts b/lib/models/wiki_acl.ts @@ -3,11 +3,15 @@ import { ACL } from '@/lib/security/acl' import { RowDataPacket } from 'mysql2' const SQL_GET_WIKI_AND_PAGE_ACL = ` - select w.id as wiki_id, w.acl_data as wiki_acl, p.id as page_id, p.acl_data as page_acl + select w.id as wiki_id, + w.acl_data as wiki_acl, + p.id as page_id, + p.acl_data as page_acl from wikis w - left join wiki_pages p on p.wiki_id = w.id + left join wiki_pages p + on p.wiki_id = w.id + and p.path = ? where w.slug = ? - and p.path = ? ` export const getWikiAndPageACLViaPath = modelBehaviour< @@ -16,7 +20,7 @@ export const getWikiAndPageACLViaPath = modelBehaviour< >(async (conn, args) => { const [rows] = await conn.query<RowDataPacket[]>({ sql: SQL_GET_WIKI_AND_PAGE_ACL, - }, args) + }, [args[1], args[0]]) if (rows.length === 0) { return null