mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-05 21:45:47 +01:00
fix: use fediverse pseudo-user for webfinger privilege checks
This commit is contained in:
@@ -31,9 +31,9 @@ Controller.webfinger = async (req, res) => {
|
|||||||
if (slug === hostname) {
|
if (slug === hostname) {
|
||||||
response = application(response);
|
response = application(response);
|
||||||
} else if (uid) {
|
} else if (uid) {
|
||||||
response = await profile(req.uid, uid, response);
|
response = await profile(uid, response);
|
||||||
} else if (cid) {
|
} else if (cid) {
|
||||||
response = await category(req.uid, cid, response);
|
response = await category(cid, response);
|
||||||
} else {
|
} else {
|
||||||
return res.sendStatus(404);
|
return res.sendStatus(404);
|
||||||
}
|
}
|
||||||
@@ -59,8 +59,8 @@ function application(response) {
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function profile(callerUid, uid, response) {
|
async function profile(uid, response) {
|
||||||
const canView = await privileges.global.can('view:users', callerUid);
|
const canView = await privileges.global.can('view:users', -2);
|
||||||
if (!canView) {
|
if (!canView) {
|
||||||
throw new Error('[[error:no-privileges]]');
|
throw new Error('[[error:no-privileges]]');
|
||||||
}
|
}
|
||||||
@@ -90,8 +90,8 @@ async function profile(callerUid, uid, response) {
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function category(callerUid, cid, response) {
|
async function category(cid, response) {
|
||||||
const canFind = await privileges.categories.can('find', cid, callerUid);
|
const canFind = await privileges.categories.can('find', cid, -2);
|
||||||
if (!canFind) {
|
if (!canFind) {
|
||||||
throw new Error('[[error:no-privileges]]');
|
throw new Error('[[error:no-privileges]]');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user