Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.
TypeScript analyticsaudience-segmentationchartscohort-analysisgoogle-analyticsproduct-analyticsstatisticsuser-journeyweb-analytics
Fix isAdmin check.
Brian Cao84375a582e8c
diff --git a/components/pages/TestConsole.js b/components/pages/TestConsole.jsindex 70b0e5043..4e80fcf8b 100644--- a/components/pages/TestConsole.js+++ b/components/pages/TestConsole.js@@ -12,7 +12,7 @@ import useFetch from 'hooks/useFetch';import styles from './TestConsole.module.css';export default function TestConsole() {- const { data } = useFetch('/websites');+ const { data } = useFetch('/websites?include_all=true');const router = useRouter();const {basePath,diff --git a/lib/auth.js b/lib/auth.jsindex eb061dcef..7a44f3606 100644--- a/lib/auth.js+++ b/lib/auth.js@@ -49,8 +49,7 @@ export async function allowQuery(req, type) {const { id } = req.query;const {- user: { id: userId },- isAdmin,+ user: { id: userId, isAdmin },shareToken,} = req.auth;diff --git a/pages/api/users/[id]/index.js b/pages/api/users/[id]/index.jsindex b8ac6f74c..a373bbd11 100644--- a/pages/api/users/[id]/index.js+++ b/pages/api/users/[id]/index.js@@ -5,7 +5,9 @@ import { useAuth } from 'lib/middleware';export default async (req, res) => {await useAuth(req, res);- const { isAdmin, userId } = req.auth;+ const {+ user: { id: userId, isAdmin },+ } = req.auth;const { id } = req.query;if (req.method === 'GET') {diff --git a/pages/api/users/index.js b/pages/api/users/index.jsindex b80e65d96..f4a5010af 100644--- a/pages/api/users/index.js+++ b/pages/api/users/index.js@@ -6,7 +6,9 @@ import { createUser, getUser, getUsers } from 'queries';export default async (req, res) => {await useAuth(req, res);- const { isAdmin } = req.auth.user;+ const {+ user: { isAdmin },+ } = req.auth;if (!isAdmin) {return unauthorized(res);diff --git a/pages/api/websites/index.js b/pages/api/websites/index.jsindex 537d38655..3966ad70b 100644--- a/pages/api/websites/index.js+++ b/pages/api/websites/index.js@@ -8,8 +8,7 @@ export default async (req, res) => {await useAuth(req, res);const {- user: { id: userId },- isAdmin,+ user: { id: userId, isAdmin },} = req.auth;if (req.method === 'GET') {