mirror of
https://github.com/umami-software/umami.git
synced 2026-02-12 16:45:35 +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
|
|
@ -10,8 +10,8 @@ export async function getPageviewMetrics(...args) {
|
|||
}
|
||||
|
||||
async function relationalQuery(websiteId, { startDate, endDate, column, table, filters = {} }) {
|
||||
const { rawQuery, parseFilters } = prisma;
|
||||
const params = [startDate, endDate];
|
||||
const { rawQuery, parseFilters, toUuid } = prisma;
|
||||
const params = [websiteId, startDate, endDate];
|
||||
const { pageviewQuery, sessionQuery, eventQuery, joinSession } = parseFilters(
|
||||
table,
|
||||
column,
|
||||
|
|
@ -24,8 +24,8 @@ async function relationalQuery(websiteId, { startDate, endDate, column, table, f
|
|||
from ${table}
|
||||
${` join website on ${table}.website_id = website.website_id`}
|
||||
${joinSession}
|
||||
where website.website_uuid='${websiteId}'
|
||||
and ${table}.created_at between $1 and $2
|
||||
where website.website_uuid = $1${toUuid()}
|
||||
and ${table}.created_at between $2 and $3
|
||||
${pageviewQuery}
|
||||
${joinSession && sessionQuery}
|
||||
${eventQuery}
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ export async function getPageviewParams(...args) {
|
|||
}
|
||||
|
||||
async function relationalQuery(websiteId, start_at, end_at, column, table, filters = {}) {
|
||||
const { parseFilters, rawQuery } = prisma;
|
||||
const params = [start_at, end_at];
|
||||
const { parseFilters, rawQuery, toUuid } = prisma;
|
||||
const params = [websiteId, start_at, end_at];
|
||||
const { pageviewQuery, sessionQuery, eventQuery, joinSession } = parseFilters(
|
||||
table,
|
||||
column,
|
||||
|
|
@ -24,8 +24,8 @@ async function relationalQuery(websiteId, start_at, end_at, column, table, filte
|
|||
from ${table}
|
||||
${` join website on ${table}.website_id = website.website_id`}
|
||||
${joinSession}
|
||||
where website.website_uuid='${websiteId}'
|
||||
and ${table}.created_at between $1 and $2
|
||||
where website.website_uuid = $1${toUuid()}
|
||||
and ${table}.created_at between $2 and $3
|
||||
and ${table}.url like '%?%'
|
||||
${pageviewQuery}
|
||||
${joinSession && sessionQuery}
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ async function relationalQuery(
|
|||
sessionKey = 'session_id',
|
||||
},
|
||||
) {
|
||||
const { getDateQuery, parseFilters, rawQuery } = prisma;
|
||||
const params = [start_at, end_at];
|
||||
const { getDateQuery, parseFilters, rawQuery, toUuid } = prisma;
|
||||
const params = [websiteId, start_at, end_at];
|
||||
const { pageviewQuery, sessionQuery, joinSession } = parseFilters(
|
||||
'pageview',
|
||||
null,
|
||||
|
|
@ -37,8 +37,8 @@ async function relationalQuery(
|
|||
join website
|
||||
on pageview.website_id = website.website_id
|
||||
${joinSession}
|
||||
where website.website_uuid='${websiteId}'
|
||||
and pageview.created_at between $1 and $2
|
||||
where website.website_uuid = $1${toUuid()}
|
||||
and pageview.created_at between $2 and $3
|
||||
${pageviewQuery}
|
||||
${sessionQuery}
|
||||
group by 1`,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue