mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
refactor: change name to privileges to match other apis
This commit is contained in:
@@ -4542,12 +4542,12 @@ paths:
|
||||
type: string
|
||||
searchDefaultSortBy:
|
||||
type: string
|
||||
permissions:
|
||||
privileges:
|
||||
type: object
|
||||
properties:
|
||||
users:
|
||||
search:users:
|
||||
type: boolean
|
||||
content:
|
||||
search:content:
|
||||
type: boolean
|
||||
required:
|
||||
- posts
|
||||
|
||||
@@ -22,12 +22,12 @@ searchController.search = async function (req, res, next) {
|
||||
|
||||
const searchOnly = parseInt(req.query.searchOnly, 10) === 1;
|
||||
|
||||
const permissions = await utils.promiseParallel({
|
||||
users: privileges.global.can('search:users', req.uid),
|
||||
content: privileges.global.can('search:content', req.uid),
|
||||
const userPrivileges = await utils.promiseParallel({
|
||||
'search:users': privileges.global.can('search:users', req.uid),
|
||||
'search:content': privileges.global.can('search:content', req.uid),
|
||||
});
|
||||
|
||||
const allowed = (req.query.in === 'users') ? permissions.users : permissions.content;
|
||||
const allowed = (req.query.in === 'users') ? userPrivileges['search:users'] : userPrivileges['search:content'];
|
||||
|
||||
if (!allowed) {
|
||||
return helpers.notAllowed(req, res);
|
||||
@@ -84,7 +84,7 @@ searchController.search = async function (req, res, next) {
|
||||
searchData.title = '[[global:header.search]]';
|
||||
|
||||
searchData.searchDefaultSortBy = meta.config.searchDefaultSortBy || '';
|
||||
searchData.permissions = permissions;
|
||||
searchData.privileges = userPrivileges;
|
||||
|
||||
res.render('search', searchData);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user