diff --git a/.github/ISSUE_TEMPLATE/1.bug_report.yml b/.github/ISSUE_TEMPLATE/1.bug_report.yml index db8be210..711468f2 100644 --- a/.github/ISSUE_TEMPLATE/1.bug_report.yml +++ b/.github/ISSUE_TEMPLATE/1.bug_report.yml @@ -1,4 +1,4 @@ -name: "🐛 Bug Report" +name: '🐛 Bug Report' description: Create a bug report for Umami. body: - type: textarea @@ -22,6 +22,10 @@ body: label: Relevant log output description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. render: shell + - type: input + attributes: + label: Which Umami version are you using? (if relevant) + description: 'For example: Chrome, Edge, Firefox, etc' - type: input attributes: label: Which browser are you using? (if relevant) @@ -29,4 +33,4 @@ body: - type: input attributes: label: How are you deploying your application? (if relevant) - description: 'For example: Vercel, Railway, Docker, etc' \ No newline at end of file + description: 'For example: Vercel, Railway, Docker, etc' diff --git a/package.components.json b/package.components.json index 41e72579..60172248 100644 --- a/package.components.json +++ b/package.components.json @@ -1,6 +1,6 @@ { "name": "@umami/components", - "version": "0.1.0", + "version": "0.40.0", "description": "Umami React components.", "author": "Mike Cao ", "license": "MIT", diff --git a/src/components/hooks/queries/useFilterQuery.ts b/src/components/hooks/queries/useFilterQuery.ts index 2f7bac09..7e4c9a86 100644 --- a/src/components/hooks/queries/useFilterQuery.ts +++ b/src/components/hooks/queries/useFilterQuery.ts @@ -10,7 +10,7 @@ export interface FilterQueryResult { setParams: Dispatch>; } -export function useFilterQuery({ +export function useFilterQuery({ queryKey, queryFn, ...options diff --git a/src/lib/auth.ts b/src/lib/auth.ts index 371e619a..eb310015 100644 --- a/src/lib/auth.ts +++ b/src/lib/auth.ts @@ -166,14 +166,14 @@ export async function canViewTeam({ user }: Auth, teamId: string) { } export async function canUpdateTeam({ user, grant }: Auth, teamId: string) { - if (cloudMode) { - return !!grant?.find(a => a === PERMISSIONS.teamUpdate); - } - if (user.isAdmin) { return true; } + if (cloudMode) { + return !!grant?.find(a => a === PERMISSIONS.teamUpdate); + } + const teamUser = await getTeamUser(teamId, user.id); return teamUser && hasPermission(teamUser.role, PERMISSIONS.teamUpdate); diff --git a/src/pages/api/teams/[teamId]/users/[userId].ts b/src/pages/api/teams/[teamId]/users/[userId].ts index da6218b1..02e5eecd 100644 --- a/src/pages/api/teams/[teamId]/users/[userId].ts +++ b/src/pages/api/teams/[teamId]/users/[userId].ts @@ -37,6 +37,16 @@ export default async ( const { teamId, userId } = req.query; + if (req.method === 'GET') { + if (!(await canUpdateTeam(req.auth, teamId))) { + return unauthorized(res, 'You must be the owner of this team.'); + } + + const teamUser = await getTeamUser(teamId, userId); + + return ok(res, teamUser); + } + if (req.method === 'POST') { if (!(await canUpdateTeam(req.auth, teamId))) { return unauthorized(res, 'You must be the owner of this team.');