mirror of
https://github.com/kremalicious/umami.git
synced 2025-02-14 21:10:34 +01:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
a91b9c9716
8
.github/ISSUE_TEMPLATE/1.bug_report.yml
vendored
8
.github/ISSUE_TEMPLATE/1.bug_report.yml
vendored
@ -1,4 +1,4 @@
|
|||||||
name: "🐛 Bug Report"
|
name: '🐛 Bug Report'
|
||||||
description: Create a bug report for Umami.
|
description: Create a bug report for Umami.
|
||||||
body:
|
body:
|
||||||
- type: textarea
|
- type: textarea
|
||||||
@ -22,6 +22,10 @@ body:
|
|||||||
label: Relevant log output
|
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.
|
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
|
||||||
render: shell
|
render: shell
|
||||||
|
- type: input
|
||||||
|
attributes:
|
||||||
|
label: Which Umami version are you using? (if relevant)
|
||||||
|
description: 'For example: Chrome, Edge, Firefox, etc'
|
||||||
- type: input
|
- type: input
|
||||||
attributes:
|
attributes:
|
||||||
label: Which browser are you using? (if relevant)
|
label: Which browser are you using? (if relevant)
|
||||||
@ -29,4 +33,4 @@ body:
|
|||||||
- type: input
|
- type: input
|
||||||
attributes:
|
attributes:
|
||||||
label: How are you deploying your application? (if relevant)
|
label: How are you deploying your application? (if relevant)
|
||||||
description: 'For example: Vercel, Railway, Docker, etc'
|
description: 'For example: Vercel, Railway, Docker, etc'
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@umami/components",
|
"name": "@umami/components",
|
||||||
"version": "0.1.0",
|
"version": "0.40.0",
|
||||||
"description": "Umami React components.",
|
"description": "Umami React components.",
|
||||||
"author": "Mike Cao <mike@mikecao.com>",
|
"author": "Mike Cao <mike@mikecao.com>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@ -10,7 +10,7 @@ export interface FilterQueryResult<T> {
|
|||||||
setParams: Dispatch<SetStateAction<T | SearchFilter>>;
|
setParams: Dispatch<SetStateAction<T | SearchFilter>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useFilterQuery<T>({
|
export function useFilterQuery<T = any>({
|
||||||
queryKey,
|
queryKey,
|
||||||
queryFn,
|
queryFn,
|
||||||
...options
|
...options
|
||||||
|
@ -166,14 +166,14 @@ export async function canViewTeam({ user }: Auth, teamId: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function canUpdateTeam({ user, grant }: Auth, teamId: string) {
|
export async function canUpdateTeam({ user, grant }: Auth, teamId: string) {
|
||||||
if (cloudMode) {
|
|
||||||
return !!grant?.find(a => a === PERMISSIONS.teamUpdate);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (user.isAdmin) {
|
if (user.isAdmin) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cloudMode) {
|
||||||
|
return !!grant?.find(a => a === PERMISSIONS.teamUpdate);
|
||||||
|
}
|
||||||
|
|
||||||
const teamUser = await getTeamUser(teamId, user.id);
|
const teamUser = await getTeamUser(teamId, user.id);
|
||||||
|
|
||||||
return teamUser && hasPermission(teamUser.role, PERMISSIONS.teamUpdate);
|
return teamUser && hasPermission(teamUser.role, PERMISSIONS.teamUpdate);
|
||||||
|
@ -37,6 +37,16 @@ export default async (
|
|||||||
|
|
||||||
const { teamId, userId } = req.query;
|
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 (req.method === 'POST') {
|
||||||
if (!(await canUpdateTeam(req.auth, teamId))) {
|
if (!(await canUpdateTeam(req.auth, teamId))) {
|
||||||
return unauthorized(res, 'You must be the owner of this team.');
|
return unauthorized(res, 'You must be the owner of this team.');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user