mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-24 05:05:20 -04:00
(admin) check for global *-users or *-community roles when accessing /api/admin/users
This commit is contained in:
parent
e1710e7362
commit
904dd92d6f
@ -31,6 +31,7 @@
|
||||
</button>
|
||||
<button
|
||||
:class="['btn', localeFilter ? 'btn-secondary' : 'btn-outline-secondary']"
|
||||
:disabled="!$isGranted('users', '*') && !$isGranted('community', '*')"
|
||||
@click="localeFilter = !localeFilter"
|
||||
>
|
||||
Only this version
|
||||
|
@ -106,7 +106,8 @@ router.get('/admin/list/footer', handleErrorAsync(async (req, res) => {
|
||||
}));
|
||||
|
||||
router.get('/admin/users', handleErrorAsync(async (req, res) => {
|
||||
if (!req.isGranted('users') && !req.isGranted('community')) {
|
||||
const checkLocale = req.query.localeFilter ? global.config.locale : '*';
|
||||
if (!req.isGranted('users', checkLocale) && !req.isGranted('community', checkLocale)) {
|
||||
return res.status(401).json({ error: 'Unauthorised' });
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user