mirror of
https://github.com/umami-software/umami.git
synced 2026-02-19 20:15:41 +01:00
Fixed share page.
This commit is contained in:
parent
cb4c8accea
commit
4c202741c2
11 changed files with 58 additions and 39 deletions
|
|
@ -25,13 +25,15 @@ export default async (
|
|||
await useCors(req, res);
|
||||
await useAuth(req, res);
|
||||
|
||||
const {
|
||||
user: { id: userId },
|
||||
} = req.auth;
|
||||
const { id: websiteId, start_at, end_at, unit, tz, url, event_name } = req.query;
|
||||
const { user, shareToken } = req.auth;
|
||||
const userId = user?.id;
|
||||
const shared = shareToken?.websiteId === websiteId;
|
||||
|
||||
if (req.method === 'GET') {
|
||||
if (canViewWebsite(userId, websiteId)) {
|
||||
const canView = canViewWebsite(userId, websiteId);
|
||||
|
||||
if (!canView && !shared) {
|
||||
return unauthorized(res);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue