fix: add canView check to /api/v3/users/:uid

This commit is contained in:
Barış Soner Uşaklı
2024-04-12 16:25:24 -04:00
parent 14f5774f6a
commit 5bee324c6a

View File

@@ -41,6 +41,10 @@ usersAPI.create = async function (caller, data) {
};
usersAPI.get = async (caller, { uid }) => {
const canView = await privileges.global.can('view:users', caller.uid);
if (!canView) {
throw new Error('[[error:no-privileges]]');
}
const userData = await user.getUserData(uid);
return await user.hidePrivateData(userData, caller.uid);
};