mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 04:37:11 +01:00
Fix share URL permissions. (#1745)
* Fix share URL permissions. * Add sql param logic. * Add permissions to edit website. * Update permissions. * Move parameters to param injection. * Sanitize eventdata. * Remove caret. * Fix avg.
This commit is contained in:
parent
558ce268a0
commit
922c3acab3
16 changed files with 139 additions and 79 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import { subMinutes } from 'date-fns';
|
||||
import { ok, methodNotAllowed, createToken } from 'next-basics';
|
||||
import { ok, unauthorized, methodNotAllowed, createToken } from 'next-basics';
|
||||
import { useAuth } from 'lib/middleware';
|
||||
import { getUserWebsites, getRealtimeData } from 'queries';
|
||||
import { secret } from 'lib/crypto';
|
||||
|
|
@ -10,6 +10,10 @@ export default async (req, res) => {
|
|||
if (req.method === 'GET') {
|
||||
const { userId } = req.auth;
|
||||
|
||||
if (!userId) {
|
||||
return unauthorized(res);
|
||||
}
|
||||
|
||||
const websites = await getUserWebsites({ userId });
|
||||
const ids = websites.map(({ websiteUuid }) => websiteUuid);
|
||||
const token = createToken({ websites: ids }, secret());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue