Skip to content

Commit d5e2d0b

Browse files
committed
Signed-off-by: Daniel <845765@qq.com>
1 parent 4b530b5 commit d5e2d0b

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

kernel/api/search.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,14 @@ func fullTextSearchBlock(c *gin.Context) {
396396
}
397397

398398
page, pageSize, query, paths, boxes, types, method, orderBy, groupBy := parseSearchBlockArgs(arg)
399+
400+
// SQL mode requires admin privileges, consistent with /api/query/sql
401+
if method == 2 && !model.IsAdminRoleContext(c) {
402+
ret.Code = -1
403+
ret.Msg = "SQL search requires administrator privileges"
404+
return
405+
}
406+
399407
blocks, matchedBlockCount, matchedRootCount, pageCount, docMode := model.FullTextSearchBlock(query, boxes, paths, types, method, orderBy, groupBy, page, pageSize)
400408
if model.IsReadOnlyRoleContext(c) {
401409
publishAccess := model.GetPublishAccess()

0 commit comments

Comments
 (0)