mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-22 18:00:17 +01:00
Fix API check.
This commit is contained in:
parent
4ab71c42a6
commit
81789d6723
@ -9,7 +9,7 @@ export default async (req, res) => {
|
||||
const { id } = req.query;
|
||||
const user_id = +id;
|
||||
|
||||
if (is_admin) {
|
||||
if (!is_admin) {
|
||||
return unauthorized(res);
|
||||
}
|
||||
|
||||
|
@ -5,16 +5,16 @@ import { ok, unauthorized, methodNotAllowed } from 'lib/response';
|
||||
export default async (req, res) => {
|
||||
await useAuth(req, res);
|
||||
|
||||
const { is_admin: current_user_is_admin } = req.auth;
|
||||
const { is_admin } = req.auth;
|
||||
|
||||
if (!is_admin) {
|
||||
return unauthorized(res);
|
||||
}
|
||||
|
||||
if (req.method === 'GET') {
|
||||
if (current_user_is_admin) {
|
||||
const accounts = await getAccounts();
|
||||
const accounts = await getAccounts();
|
||||
|
||||
return ok(res, accounts);
|
||||
}
|
||||
|
||||
return unauthorized(res);
|
||||
return ok(res, accounts);
|
||||
}
|
||||
|
||||
return methodNotAllowed(res);
|
||||
|
Loading…
Reference in New Issue
Block a user