mirror of
https://github.com/umami-software/umami.git
synced 2025-12-06 01:18:00 +01:00
fix reports permissions, long team overflow, language settings
This commit is contained in:
parent
f5bf148b2b
commit
d87ae84a29
4 changed files with 20 additions and 13 deletions
|
|
@ -1,10 +1,10 @@
|
|||
'use client';
|
||||
import { ReactNode } from 'react';
|
||||
import { Grid, Column } from '@umami/react-zen';
|
||||
import { useMessages, useNavigation } from '@/components/hooks';
|
||||
import { PageBody } from '@/components/common/PageBody';
|
||||
import { SideMenu } from '@/components/common/SideMenu';
|
||||
import { UserCircle, Users, Settings2 } from '@/components/icons';
|
||||
import { useMessages, useNavigation } from '@/components/hooks';
|
||||
import { Settings2, UserCircle, Users } from '@/components/icons';
|
||||
import { Column, Grid } from '@umami/react-zen';
|
||||
import { ReactNode } from 'react';
|
||||
|
||||
export function SettingsLayout({ children }: { children: ReactNode }) {
|
||||
const { formatMessage, labels } = useMessages();
|
||||
|
|
@ -46,8 +46,15 @@ export function SettingsLayout({ children }: { children: ReactNode }) {
|
|||
.find(({ path }) => path && pathname.includes(path.split('?')[0]))?.id;
|
||||
|
||||
return (
|
||||
<Grid columns="auto 1fr" width="100%" height="100%">
|
||||
<Column height="100%" border="right" backgroundColor>
|
||||
<Grid columns={{ xs: '1fr', lg: 'auto 1fr' }} width="100%" height="100%">
|
||||
<Column
|
||||
display={{ xs: 'none', lg: 'flex' }}
|
||||
width="240px"
|
||||
height="100%"
|
||||
border="right"
|
||||
backgroundColor
|
||||
marginRight="2"
|
||||
>
|
||||
<SideMenu
|
||||
items={items}
|
||||
title={formatMessage(labels.settings)}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import { parseRequest } from '@/lib/request';
|
||||
import { deleteReport, getReport, updateReport } from '@/queries/prisma';
|
||||
import { canDeleteReport, canUpdateReport, canViewReport } from '@/permissions';
|
||||
import { unauthorized, json, notFound, ok } from '@/lib/response';
|
||||
import { json, notFound, ok, unauthorized } from '@/lib/response';
|
||||
import { reportSchema } from '@/lib/schema';
|
||||
import { canDeleteWebsite, canUpdateWebsite, canViewReport } from '@/permissions';
|
||||
import { deleteReport, getReport, updateReport } from '@/queries/prisma';
|
||||
|
||||
export async function GET(request: Request, { params }: { params: Promise<{ reportId: string }> }) {
|
||||
const { auth, error } = await parseRequest(request);
|
||||
|
|
@ -41,7 +41,7 @@ export async function POST(
|
|||
return notFound();
|
||||
}
|
||||
|
||||
if (!(await canUpdateReport(auth, report))) {
|
||||
if (!(await canUpdateWebsite(auth, websiteId))) {
|
||||
return unauthorized();
|
||||
}
|
||||
|
||||
|
|
@ -70,7 +70,7 @@ export async function DELETE(
|
|||
const { reportId } = await params;
|
||||
const report = await getReport(reportId);
|
||||
|
||||
if (!(await canDeleteReport(auth, report))) {
|
||||
if (!(await canDeleteWebsite(auth, report.websiteId))) {
|
||||
return unauthorized();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ export function useLocale() {
|
|||
}
|
||||
|
||||
async function saveLocale(value: string) {
|
||||
if (!messages[value]) {
|
||||
if (!messages[value] && !process.env.cloudMode) {
|
||||
await loadMessages(value);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ export function NavButton({ showText = true }: TeamsButtonProps) {
|
|||
shadow="1"
|
||||
maxHeight="40px"
|
||||
role="button"
|
||||
style={{ cursor: 'pointer', textWrap: 'nowrap', outline: 'none' }}
|
||||
style={{ cursor: 'pointer', textWrap: 'nowrap', overflow: 'hidden', outline: 'none' }}
|
||||
>
|
||||
<Row alignItems="center" position="relative" gap maxHeight="40px">
|
||||
<Icon>{teamId ? <Users /> : <User />}</Icon>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue