From 8dc09ca69195ea65fd6a393144adfa158a7bc36f Mon Sep 17 00:00:00 2001 From: Kraiem Taha Yassine Date: Tue, 23 Jul 2024 16:00:26 +0200 Subject: [PATCH] Dev (#2419) * refactor(chalice): upgraded dependencies * refactor(chalice): upgraded dependencies feat(chalice): support heatmaps * feat(chalice): support table-of-browsers showing user-count * feat(chalice): support table-of-devices showing user-count * feat(chalice): support table-of-URLs showing user-count * fix(chalice): fixed Math-operators validation refactor(chalice): search for sessions that have events for heatmaps * refactor(chalice): search for sessions that have at least 1 location event for heatmaps * refactor(chalice): upgraded dependencies * refactor(chalice): upgraded dependencies feat(chalice): support heatmaps * feat(chalice): support table-of-browsers showing user-count * feat(chalice): support table-of-devices showing user-count * feat(chalice): support table-of-URLs showing user-count * fix(chalice): fixed Math-operators validation refactor(chalice): search for sessions that have events for heatmaps * refactor(chalice): search for sessions that have at least 1 location event for heatmaps * refactor(chalice): refactored search sessions hooks * refactor(chalice): refactored schemas * refactor(chalice): refactored schemas refactor(chalice): cleaned scripts feat(chalice): search sessions by CSS selector (PG) * refactor(chalice): upgraded dependencies refactor(crons): upgraded dependencies refactor(alerts): upgraded dependencies * feat(chalice): search by selectors * feat(chalice): support Spot permissions feat(DB): support Spot permissions --- ee/api/schemas/schemas_ee.py | 3 +++ .../schema/db/init_dbs/postgresql/1.20.0/1.20.0.sql | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/ee/api/schemas/schemas_ee.py b/ee/api/schemas/schemas_ee.py index f70fa50bf..651d1a2ac 100644 --- a/ee/api/schemas/schemas_ee.py +++ b/ee/api/schemas/schemas_ee.py @@ -16,6 +16,8 @@ class Permissions(str, Enum): ASSIST_LIVE = "ASSIST_LIVE" ASSIST_CALL = "ASSIST_CALL" FEATURE_FLAGS = "FEATURE_FLAGS" + SPOT = "SPOT" + SPOT_PUBLIC = "SPOT_PUBLIC" class ServicePermissions(str, Enum): @@ -146,6 +148,7 @@ class AssistRecordSearchPayloadSchema(schemas._PaginatedSchema, schemas._TimedSc query: Optional[str] = Field(default=None) order: Literal["asc", "desc"] = Field(default="desc") + # TODO: move these to schema when Insights is supported on PG class CardInsights(schemas.CardInsights): metric_value: List[InsightCategories] = Field(default=[]) diff --git a/ee/scripts/schema/db/init_dbs/postgresql/1.20.0/1.20.0.sql b/ee/scripts/schema/db/init_dbs/postgresql/1.20.0/1.20.0.sql index c0939d7b4..c69a20549 100644 --- a/ee/scripts/schema/db/init_dbs/postgresql/1.20.0/1.20.0.sql +++ b/ee/scripts/schema/db/init_dbs/postgresql/1.20.0/1.20.0.sql @@ -22,6 +22,17 @@ ALTER TABLE IF EXISTS events.clicks ALTER COLUMN normalized_x SET DATA TYPE decimal, ALTER COLUMN normalized_y SET DATA TYPE decimal; +UPDATE public.roles +SET permissions = (SELECT array_agg(distinct e) FROM unnest(permissions || '{SPOT}') AS e) +WHERE NOT permissions @> '{SPOT}' + AND NOT service_role; + +UPDATE public.roles +SET permissions = (SELECT array_agg(distinct e) FROM unnest(permissions || '{SPOT_PUBLIC}') AS e) +WHERE NOT permissions @> '{SPOT_PUBLIC}' + AND name ILIKE 'owner'; + + COMMIT; \elif :is_next