mirror of
https://github.com/BillyOutlast/posthog.git
synced 2026-02-04 03:01:23 +01:00
feat: configurable sessions lengths (#33065)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
@@ -41,6 +41,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -114,6 +115,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -220,6 +222,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -249,6 +252,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
|
||||
@@ -4,6 +4,7 @@ import { loaders } from 'kea-loaders'
|
||||
import { encodeParams, urlToAction } from 'kea-router'
|
||||
import { router } from 'kea-router'
|
||||
import api from 'lib/api'
|
||||
import { lemonToast } from 'lib/lemon-ui/LemonToast'
|
||||
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
|
||||
import { getRelativeNextPath } from 'lib/utils'
|
||||
import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'
|
||||
@@ -138,12 +139,18 @@ export const loginLogic = kea<loginLogicType>([
|
||||
},
|
||||
}),
|
||||
urlToAction(({ actions }) => ({
|
||||
'/login': (_, { error_code, error_detail, email }) => {
|
||||
'/login': (_, { error_code, error_detail, email, message }) => {
|
||||
if (error_code) {
|
||||
actions.setGeneralError(error_code, error_detail)
|
||||
router.actions.replace('/login', {})
|
||||
}
|
||||
|
||||
if (message) {
|
||||
lemonToast.info(message)
|
||||
const { message: _, ...otherParams } = router.values.searchParams
|
||||
router.actions.replace('/login', otherParams)
|
||||
}
|
||||
|
||||
// This allows us to give a quick login link in the `generate_demo_data` command
|
||||
if (email) {
|
||||
actions.setLoginValue('email', email)
|
||||
|
||||
@@ -134,6 +134,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -217,6 +218,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -246,6 +248,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -471,6 +474,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -566,6 +570,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -595,6 +600,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -700,6 +706,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -783,6 +790,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -812,6 +820,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
|
||||
@@ -122,6 +122,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -205,6 +206,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -453,6 +455,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -548,6 +551,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -676,6 +680,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -759,6 +764,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -82,6 +83,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -126,6 +128,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -163,6 +166,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -198,6 +202,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -242,6 +247,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -1020,6 +1026,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -1167,6 +1174,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -1204,6 +1212,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -1248,6 +1257,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -1285,6 +1295,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -4232,6 +4243,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -4267,6 +4279,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -4311,6 +4324,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -4348,6 +4362,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -4383,6 +4398,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -4427,6 +4443,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -5205,6 +5222,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -5539,7 +5557,49 @@
|
||||
AND "posthog_pluginconfig"."team_id" = 99999)
|
||||
'''
|
||||
# ---
|
||||
<<<<<<< HEAD
|
||||
# name: TestDecideRemoteConfig.test_decide_doesnt_error_out_when_database_is_down.4
|
||||
'''
|
||||
SELECT "posthog_organizationmembership"."id",
|
||||
"posthog_organizationmembership"."organization_id",
|
||||
"posthog_organizationmembership"."user_id",
|
||||
"posthog_organizationmembership"."level",
|
||||
"posthog_organizationmembership"."joined_at",
|
||||
"posthog_organizationmembership"."updated_at",
|
||||
"posthog_organization"."id",
|
||||
"posthog_organization"."name",
|
||||
"posthog_organization"."slug",
|
||||
"posthog_organization"."logo_media_id",
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
"posthog_organization"."enforce_2fa",
|
||||
"posthog_organization"."members_can_invite",
|
||||
"posthog_organization"."is_hipaa",
|
||||
"posthog_organization"."customer_id",
|
||||
"posthog_organization"."available_product_features",
|
||||
"posthog_organization"."usage",
|
||||
"posthog_organization"."never_drop_data",
|
||||
"posthog_organization"."customer_trust_scores",
|
||||
"posthog_organization"."setup_section_2_completed",
|
||||
"posthog_organization"."personalization",
|
||||
"posthog_organization"."domain_whitelist",
|
||||
"posthog_organization"."is_platform"
|
||||
FROM "posthog_organizationmembership"
|
||||
INNER JOIN "posthog_organization" ON ("posthog_organizationmembership"."organization_id" = "posthog_organization"."id")
|
||||
WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid
|
||||
AND "posthog_organizationmembership"."user_id" = 99999)
|
||||
LIMIT 21
|
||||
'''
|
||||
# ---
|
||||
# name: TestDecideRemoteConfig.test_decide_doesnt_error_out_when_database_is_down.40
|
||||
=======
|
||||
# name: TestDecideRemoteConfig.test_decide_doesnt_error_out_when_database_is_down.42
|
||||
>>>>>>> origin/master
|
||||
'''
|
||||
SELECT "posthog_pluginconfig"."id",
|
||||
"posthog_pluginsourcefile"."transpiled",
|
||||
@@ -5978,7 +6038,47 @@
|
||||
AND "posthog_pluginconfig"."team_id" = 99999)
|
||||
'''
|
||||
# ---
|
||||
<<<<<<< HEAD
|
||||
# name: TestDecideRemoteConfig.test_decide_doesnt_error_out_when_database_is_down.5
|
||||
'''
|
||||
SELECT "posthog_organizationmembership"."id",
|
||||
"posthog_organizationmembership"."organization_id",
|
||||
"posthog_organizationmembership"."user_id",
|
||||
"posthog_organizationmembership"."level",
|
||||
"posthog_organizationmembership"."joined_at",
|
||||
"posthog_organizationmembership"."updated_at",
|
||||
"posthog_organization"."id",
|
||||
"posthog_organization"."name",
|
||||
"posthog_organization"."slug",
|
||||
"posthog_organization"."logo_media_id",
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
"posthog_organization"."enforce_2fa",
|
||||
"posthog_organization"."members_can_invite",
|
||||
"posthog_organization"."is_hipaa",
|
||||
"posthog_organization"."customer_id",
|
||||
"posthog_organization"."available_product_features",
|
||||
"posthog_organization"."usage",
|
||||
"posthog_organization"."never_drop_data",
|
||||
"posthog_organization"."customer_trust_scores",
|
||||
"posthog_organization"."setup_section_2_completed",
|
||||
"posthog_organization"."personalization",
|
||||
"posthog_organization"."domain_whitelist",
|
||||
"posthog_organization"."is_platform"
|
||||
FROM "posthog_organizationmembership"
|
||||
INNER JOIN "posthog_organization" ON ("posthog_organizationmembership"."organization_id" = "posthog_organization"."id")
|
||||
WHERE "posthog_organizationmembership"."user_id" = 99999
|
||||
'''
|
||||
# ---
|
||||
# name: TestDecideRemoteConfig.test_decide_doesnt_error_out_when_database_is_down.50
|
||||
=======
|
||||
# name: TestDecideRemoteConfig.test_decide_doesnt_error_out_when_database_is_down.53
|
||||
>>>>>>> origin/master
|
||||
'''
|
||||
SELECT "posthog_hogfunction"."id",
|
||||
"posthog_hogfunction"."team_id",
|
||||
@@ -6112,6 +6212,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -6149,6 +6250,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
|
||||
@@ -129,6 +129,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -212,6 +213,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
|
||||
@@ -2504,6 +2504,26 @@
|
||||
LIMIT 100 SETTINGS optimize_aggregation_in_order = 1
|
||||
'''
|
||||
# ---
|
||||
# name: TestFeatureFlag.test_creating_static_cohort.25
|
||||
'''
|
||||
/* user_id:0 request:_snapshot_ */
|
||||
SELECT id
|
||||
FROM person
|
||||
INNER JOIN
|
||||
(SELECT person_id
|
||||
FROM person_static_cohort
|
||||
WHERE team_id = 99999
|
||||
AND cohort_id = 99999
|
||||
GROUP BY person_id,
|
||||
cohort_id,
|
||||
team_id) cohort_persons ON cohort_persons.person_id = person.id
|
||||
WHERE team_id = 99999
|
||||
GROUP BY id
|
||||
HAVING max(is_deleted) = 0
|
||||
ORDER BY argMax(person.created_at, version) DESC, id DESC
|
||||
LIMIT 100 SETTINGS optimize_aggregation_in_order = 1
|
||||
'''
|
||||
# ---
|
||||
# name: TestFeatureFlag.test_creating_static_cohort.3
|
||||
'''
|
||||
SELECT "posthog_organizationmembership"."id",
|
||||
@@ -2519,6 +2539,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -2602,6 +2623,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -2631,6 +2653,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
|
||||
@@ -1060,6 +1060,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -1143,6 +1144,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -1336,6 +1338,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -1419,6 +1422,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -1448,6 +1452,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -1796,6 +1801,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -1937,6 +1943,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -2066,6 +2073,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -526,6 +527,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -1499,6 +1501,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -2279,6 +2282,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -2331,6 +2335,43 @@
|
||||
LIMIT 1
|
||||
'''
|
||||
# ---
|
||||
# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.60
|
||||
'''
|
||||
SELECT "posthog_organizationmembership"."id",
|
||||
"posthog_organizationmembership"."organization_id",
|
||||
"posthog_organizationmembership"."user_id",
|
||||
"posthog_organizationmembership"."level",
|
||||
"posthog_organizationmembership"."joined_at",
|
||||
"posthog_organizationmembership"."updated_at",
|
||||
"posthog_organization"."id",
|
||||
"posthog_organization"."name",
|
||||
"posthog_organization"."slug",
|
||||
"posthog_organization"."logo_media_id",
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
"posthog_organization"."enforce_2fa",
|
||||
"posthog_organization"."members_can_invite",
|
||||
"posthog_organization"."is_hipaa",
|
||||
"posthog_organization"."customer_id",
|
||||
"posthog_organization"."available_product_features",
|
||||
"posthog_organization"."usage",
|
||||
"posthog_organization"."never_drop_data",
|
||||
"posthog_organization"."customer_trust_scores",
|
||||
"posthog_organization"."setup_section_2_completed",
|
||||
"posthog_organization"."personalization",
|
||||
"posthog_organization"."domain_whitelist"
|
||||
FROM "posthog_organizationmembership"
|
||||
INNER JOIN "posthog_organization" ON ("posthog_organizationmembership"."organization_id" = "posthog_organization"."id")
|
||||
WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid
|
||||
AND "posthog_organizationmembership"."user_id" = 99999)
|
||||
LIMIT 21
|
||||
'''
|
||||
# ---
|
||||
# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.7
|
||||
'''
|
||||
SELECT 1 AS "a"
|
||||
@@ -2421,6 +2462,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -70,6 +71,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -108,6 +110,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -143,6 +146,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -240,6 +244,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -310,6 +315,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -339,6 +345,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -368,6 +375,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -406,6 +414,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -441,6 +450,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -538,6 +548,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -608,6 +619,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -637,6 +649,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -684,6 +697,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -719,6 +733,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -816,6 +831,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -853,6 +869,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -888,6 +905,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -993,6 +1011,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
|
||||
@@ -116,6 +116,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -356,6 +357,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -439,6 +441,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -476,6 +479,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -518,6 +522,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -1465,6 +1470,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -2263,6 +2269,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -2292,6 +2299,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -2402,6 +2410,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -2636,6 +2645,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -2719,6 +2729,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -2748,6 +2759,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -2980,6 +2992,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -4106,6 +4119,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -4135,6 +4149,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -4457,6 +4472,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -4540,6 +4556,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -5313,6 +5330,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -5356,6 +5374,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -5671,6 +5690,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -5770,6 +5790,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -5812,6 +5833,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -6980,6 +7002,62 @@
|
||||
AND "ee_accesscontrol"."team_id" = 99999))
|
||||
'''
|
||||
# ---
|
||||
# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.174
|
||||
'''
|
||||
SELECT "posthog_dashboard"."id",
|
||||
"posthog_dashboard"."name",
|
||||
"posthog_dashboard"."description",
|
||||
"posthog_dashboard"."team_id",
|
||||
"posthog_dashboard"."pinned",
|
||||
"posthog_dashboard"."created_at",
|
||||
"posthog_dashboard"."created_by_id",
|
||||
"posthog_dashboard"."deleted",
|
||||
"posthog_dashboard"."last_accessed_at",
|
||||
"posthog_dashboard"."filters",
|
||||
"posthog_dashboard"."variables",
|
||||
"posthog_dashboard"."breakdown_colors",
|
||||
"posthog_dashboard"."data_color_theme_id",
|
||||
"posthog_dashboard"."creation_mode",
|
||||
"posthog_dashboard"."restriction_level",
|
||||
"posthog_dashboard"."deprecated_tags",
|
||||
"posthog_dashboard"."tags",
|
||||
"posthog_dashboard"."share_token",
|
||||
"posthog_dashboard"."is_shared"
|
||||
FROM "posthog_dashboard"
|
||||
WHERE (NOT ("posthog_dashboard"."deleted")
|
||||
AND "posthog_dashboard"."id" IN (1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5 /* ... */))
|
||||
'''
|
||||
# ---
|
||||
# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.175
|
||||
'''
|
||||
SELECT "ee_accesscontrol"."id",
|
||||
"ee_accesscontrol"."team_id",
|
||||
"ee_accesscontrol"."access_level",
|
||||
"ee_accesscontrol"."resource",
|
||||
"ee_accesscontrol"."resource_id",
|
||||
"ee_accesscontrol"."organization_member_id",
|
||||
"ee_accesscontrol"."role_id",
|
||||
"ee_accesscontrol"."created_by_id",
|
||||
"ee_accesscontrol"."created_at",
|
||||
"ee_accesscontrol"."updated_at"
|
||||
FROM "ee_accesscontrol"
|
||||
LEFT OUTER JOIN "posthog_organizationmembership" ON ("ee_accesscontrol"."organization_member_id" = "posthog_organizationmembership"."id")
|
||||
WHERE (("ee_accesscontrol"."organization_member_id" IS NULL
|
||||
AND "ee_accesscontrol"."resource" = 'insight'
|
||||
AND "ee_accesscontrol"."resource_id" IS NULL
|
||||
AND "ee_accesscontrol"."role_id" IS NULL
|
||||
AND "ee_accesscontrol"."team_id" = 99999)
|
||||
OR ("posthog_organizationmembership"."user_id" = 99999
|
||||
AND "ee_accesscontrol"."resource" = 'insight'
|
||||
AND "ee_accesscontrol"."resource_id" IS NULL
|
||||
AND "ee_accesscontrol"."role_id" IS NULL
|
||||
AND "ee_accesscontrol"."team_id" = 99999))
|
||||
'''
|
||||
# ---
|
||||
# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.18
|
||||
'''
|
||||
SELECT "posthog_user"."id",
|
||||
@@ -7103,6 +7181,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -7140,6 +7219,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -7223,6 +7303,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -7380,6 +7461,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -7917,6 +7999,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -8000,6 +8083,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -8035,6 +8119,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -9166,6 +9251,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -9195,6 +9281,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -9532,6 +9619,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -9615,6 +9703,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -10317,6 +10406,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -10346,6 +10436,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -10450,6 +10541,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -10690,6 +10782,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -10773,6 +10866,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -11530,6 +11624,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -11613,6 +11708,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -11655,6 +11751,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -12311,6 +12408,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -12348,6 +12446,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -12431,6 +12530,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -12588,6 +12688,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -13125,6 +13226,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -13208,6 +13310,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -13243,6 +13346,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -13285,6 +13389,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -13449,6 +13554,65 @@
|
||||
AND "ee_accesscontrol"."team_id" = 99999))
|
||||
'''
|
||||
# ---
|
||||
# name: TestDashboard.test_retrieve_dashboard_list.48
|
||||
'''
|
||||
SELECT "posthog_taggeditem"."id",
|
||||
"posthog_taggeditem"."tag_id",
|
||||
"posthog_taggeditem"."dashboard_id",
|
||||
"posthog_taggeditem"."insight_id",
|
||||
"posthog_taggeditem"."event_definition_id",
|
||||
"posthog_taggeditem"."property_definition_id",
|
||||
"posthog_taggeditem"."action_id",
|
||||
"posthog_taggeditem"."feature_flag_id",
|
||||
"posthog_taggeditem"."experiment_saved_metric_id",
|
||||
"posthog_tag"."id",
|
||||
"posthog_tag"."name",
|
||||
"posthog_tag"."team_id"
|
||||
FROM "posthog_taggeditem"
|
||||
INNER JOIN "posthog_tag" ON ("posthog_taggeditem"."tag_id" = "posthog_tag"."id")
|
||||
WHERE "posthog_taggeditem"."dashboard_id" IN (1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5 /* ... */)
|
||||
'''
|
||||
# ---
|
||||
# name: TestDashboard.test_retrieve_dashboard_list.49
|
||||
'''
|
||||
SELECT "ee_accesscontrol"."id",
|
||||
"ee_accesscontrol"."team_id",
|
||||
"ee_accesscontrol"."access_level",
|
||||
"ee_accesscontrol"."resource",
|
||||
"ee_accesscontrol"."resource_id",
|
||||
"ee_accesscontrol"."organization_member_id",
|
||||
"ee_accesscontrol"."role_id",
|
||||
"ee_accesscontrol"."created_by_id",
|
||||
"ee_accesscontrol"."created_at",
|
||||
"ee_accesscontrol"."updated_at"
|
||||
FROM "ee_accesscontrol"
|
||||
LEFT OUTER JOIN "posthog_organizationmembership" ON ("ee_accesscontrol"."organization_member_id" = "posthog_organizationmembership"."id")
|
||||
WHERE (("ee_accesscontrol"."organization_member_id" IS NULL
|
||||
AND "ee_accesscontrol"."resource" = 'dashboard'
|
||||
AND "ee_accesscontrol"."resource_id" = '99999'
|
||||
AND "ee_accesscontrol"."role_id" IS NULL
|
||||
AND "ee_accesscontrol"."team_id" = 99999)
|
||||
OR ("posthog_organizationmembership"."user_id" = 99999
|
||||
AND "ee_accesscontrol"."resource" = 'dashboard'
|
||||
AND "ee_accesscontrol"."resource_id" = '99999'
|
||||
AND "ee_accesscontrol"."role_id" IS NULL
|
||||
AND "ee_accesscontrol"."team_id" = 99999)
|
||||
OR ("ee_accesscontrol"."organization_member_id" IS NULL
|
||||
AND "ee_accesscontrol"."resource" = 'dashboard'
|
||||
AND "ee_accesscontrol"."resource_id" = '99999'
|
||||
AND "ee_accesscontrol"."role_id" IS NULL
|
||||
AND "ee_accesscontrol"."team_id" = 99999)
|
||||
OR ("posthog_organizationmembership"."user_id" = 99999
|
||||
AND "ee_accesscontrol"."resource" = 'dashboard'
|
||||
AND "ee_accesscontrol"."resource_id" = '99999'
|
||||
AND "ee_accesscontrol"."role_id" IS NULL
|
||||
AND "ee_accesscontrol"."team_id" = 99999))
|
||||
'''
|
||||
# ---
|
||||
# name: TestDashboard.test_retrieve_dashboard_list.5
|
||||
'''
|
||||
SELECT 1 AS "a"
|
||||
@@ -13586,6 +13750,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
|
||||
@@ -122,6 +122,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -205,6 +206,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -721,6 +723,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -804,6 +807,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -951,6 +955,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -1034,6 +1039,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
|
||||
@@ -26,6 +26,7 @@ from django_prometheus.middleware import (
|
||||
)
|
||||
from rest_framework import status
|
||||
from statshog.defaults.django import statsd
|
||||
from django.core.cache import cache
|
||||
|
||||
from posthog.api.capture import get_event
|
||||
from posthog.api.decide import get_decide
|
||||
@@ -645,7 +646,30 @@ class SessionAgeMiddleware:
|
||||
def __call__(self, request: HttpRequest):
|
||||
# NOTE: This should be covered by the post_login signal, but we add it here as a fallback
|
||||
get_or_set_session_cookie_created_at(request=request)
|
||||
return self.get_response(request)
|
||||
|
||||
if request.user.is_authenticated:
|
||||
# Get session creation time
|
||||
session_created_at = request.session.get(settings.SESSION_COOKIE_CREATED_AT_KEY)
|
||||
if session_created_at:
|
||||
# Get timeout from Redis cache first, fallback to settings
|
||||
org_id = request.user.current_organization_id
|
||||
session_age = None
|
||||
if org_id:
|
||||
session_age = cache.get(f"org_session_age:{org_id}")
|
||||
|
||||
if session_age is None:
|
||||
session_age = settings.SESSION_COOKIE_AGE
|
||||
|
||||
current_time = time.time()
|
||||
if current_time - session_created_at > session_age:
|
||||
# Log out the user
|
||||
from django.contrib.auth import logout
|
||||
|
||||
logout(request)
|
||||
return redirect("/login?message=Your session has expired. Please log in again.")
|
||||
|
||||
response = self.get_response(request)
|
||||
return response
|
||||
|
||||
|
||||
def get_impersonated_session_expires_at(request: HttpRequest) -> Optional[datetime]:
|
||||
|
||||
21
posthog/migrations/0757_organization_session_cookie_age.py
Normal file
21
posthog/migrations/0757_organization_session_cookie_age.py
Normal file
@@ -0,0 +1,21 @@
|
||||
# Generated by Django 4.2.18 on 2025-06-03 10:46
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("posthog", "0756_errortrackingsymbolset_last_used"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="organization",
|
||||
name="session_cookie_age",
|
||||
field=models.IntegerField(
|
||||
blank=True,
|
||||
help_text="Custom session cookie age in seconds. If not set, the global setting SESSION_COOKIE_AGE will be used.",
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
]
|
||||
@@ -1 +1 @@
|
||||
0756_errortrackingsymbolset_last_used
|
||||
0757_organization_session_cookie_age
|
||||
@@ -12,6 +12,8 @@ from django.dispatch import receiver
|
||||
from django.utils import timezone
|
||||
from rest_framework import exceptions
|
||||
from posthog.models.personal_api_key import PersonalAPIKey
|
||||
from django.db.models.signals import post_save
|
||||
from django.core.cache import cache
|
||||
|
||||
from posthog.cloud_utils import is_cloud
|
||||
from posthog.constants import INVITE_DAYS_VALIDITY, MAX_SLUG_LENGTH, AvailableFeature
|
||||
@@ -130,6 +132,11 @@ class Organization(UUIDModel):
|
||||
default=PluginsAccessLevel.CONFIG,
|
||||
choices=PluginsAccessLevel.choices,
|
||||
)
|
||||
session_cookie_age = models.IntegerField(
|
||||
null=True,
|
||||
blank=True,
|
||||
help_text="Custom session cookie age in seconds. If not set, the global setting SESSION_COOKIE_AGE will be used.",
|
||||
)
|
||||
for_internal_metrics = models.BooleanField(default=False)
|
||||
is_member_join_email_enabled = models.BooleanField(default=True)
|
||||
is_ai_data_processing_approved = models.BooleanField(null=True, blank=True)
|
||||
@@ -390,3 +397,12 @@ def organization_membership_saved(sender: Any, instance: OrganizationMembership,
|
||||
except OrganizationMembership.DoesNotExist:
|
||||
# The instance is new, or we are setting up test data
|
||||
pass
|
||||
|
||||
|
||||
@receiver(post_save, sender=Organization)
|
||||
def cache_organization_session_age(sender, instance, **kwargs):
|
||||
"""Cache organization's session_cookie_age in Redis when it changes."""
|
||||
if instance.session_cookie_age is not None:
|
||||
cache.set(f"org_session_age:{instance.id}", instance.session_cookie_age)
|
||||
else:
|
||||
cache.delete(f"org_session_age:{instance.id}")
|
||||
|
||||
@@ -2,6 +2,7 @@ from unittest import mock
|
||||
from unittest.mock import patch
|
||||
|
||||
from django.utils import timezone
|
||||
from django.core.cache import cache
|
||||
|
||||
from posthog.models import Organization, OrganizationInvite, Plugin
|
||||
from posthog.models.organization import OrganizationMembership
|
||||
@@ -11,6 +12,10 @@ from posthog.test.base import BaseTest
|
||||
|
||||
|
||||
class TestOrganization(BaseTest):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
cache.clear()
|
||||
|
||||
def test_organization_active_invites(self):
|
||||
self.assertEqual(self.organization.invites.count(), 0)
|
||||
self.assertEqual(self.organization.active_invites.count(), 0)
|
||||
@@ -83,6 +88,22 @@ class TestOrganization(BaseTest):
|
||||
{"key": "test2", "name": "test2"},
|
||||
]
|
||||
|
||||
def test_session_age_caching(self):
|
||||
# Test caching when session_cookie_age is set
|
||||
self.organization.session_cookie_age = 3600
|
||||
self.organization.save()
|
||||
self.assertEqual(cache.get(f"org_session_age:{self.organization.id}"), 3600)
|
||||
|
||||
# Test cache deletion when session_cookie_age is set to None
|
||||
self.organization.session_cookie_age = None
|
||||
self.organization.save()
|
||||
self.assertIsNone(cache.get(f"org_session_age:{self.organization.id}"))
|
||||
|
||||
# Test cache update when session_cookie_age changes
|
||||
self.organization.session_cookie_age = 7200
|
||||
self.organization.save()
|
||||
self.assertEqual(cache.get(f"org_session_age:{self.organization.id}"), 7200)
|
||||
|
||||
|
||||
class TestOrganizationMembership(BaseTest):
|
||||
@patch("posthoganalytics.capture")
|
||||
|
||||
@@ -104,6 +104,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -484,6 +485,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -567,6 +569,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -977,6 +980,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -1060,6 +1064,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -1615,6 +1620,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
|
||||
@@ -616,6 +616,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -781,6 +782,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -810,6 +812,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -2038,6 +2041,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -2121,6 +2125,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -2150,6 +2155,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -2766,6 +2772,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -2849,6 +2856,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -2878,6 +2886,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -3449,6 +3458,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -3532,6 +3542,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -3561,6 +3572,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -4159,6 +4171,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -4196,6 +4209,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -4279,6 +4293,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -4308,6 +4323,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -4881,6 +4897,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -4964,6 +4981,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -4999,6 +5017,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -5028,6 +5047,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -5293,6 +5313,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -5360,6 +5381,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -5903,6 +5925,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -5986,6 +6009,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -6015,6 +6039,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -6089,6 +6114,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -6435,6 +6461,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -6578,6 +6605,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -6661,6 +6689,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -6690,6 +6719,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -7232,6 +7262,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -7315,6 +7346,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -7344,6 +7376,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -7877,6 +7910,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -8036,6 +8070,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -8065,6 +8100,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
|
||||
@@ -82,12 +82,12 @@ MIDDLEWARE = [
|
||||
"posthog.middleware.AllowIPMiddleware",
|
||||
"whitenoise.middleware.WhiteNoiseMiddleware",
|
||||
"django.contrib.sessions.middleware.SessionMiddleware",
|
||||
"posthog.middleware.SessionAgeMiddleware",
|
||||
"corsheaders.middleware.CorsMiddleware",
|
||||
"django.middleware.common.CommonMiddleware",
|
||||
"posthog.middleware.CsrfOrKeyViewMiddleware",
|
||||
"posthog.middleware.QueryTimeCountingMiddleware",
|
||||
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
||||
"posthog.middleware.SessionAgeMiddleware",
|
||||
"posthog.middleware.user_logging_context_middleware",
|
||||
"django_otp.middleware.OTPMiddleware",
|
||||
"django.contrib.messages.middleware.MessageMiddleware",
|
||||
@@ -204,8 +204,8 @@ SOCIAL_AUTH_GITLAB_API_URL: str = os.getenv("SOCIAL_AUTH_GITLAB_API_URL", "https
|
||||
# Cookie age in seconds (default 2 weeks) - these are the standard defaults for Django but having it here to be explicit
|
||||
SESSION_COOKIE_AGE = get_from_env("SESSION_COOKIE_AGE", 60 * 60 * 24 * 14, type_cast=int)
|
||||
|
||||
# For sensitive actions we have an additional permission (default 1 hour)
|
||||
SESSION_SENSITIVE_ACTIONS_AGE = get_from_env("SESSION_SENSITIVE_ACTIONS_AGE", 60 * 60 * 6, type_cast=int)
|
||||
# For sensitive actions we have an additional permission (default 2 hour)
|
||||
SESSION_SENSITIVE_ACTIONS_AGE = get_from_env("SESSION_SENSITIVE_ACTIONS_AGE", 60 * 60 * 2, type_cast=int)
|
||||
|
||||
CSRF_COOKIE_NAME = "posthog_csrftoken"
|
||||
CSRF_COOKIE_AGE = get_from_env("CSRF_COOKIE_AGE", SESSION_COOKIE_AGE, type_cast=int)
|
||||
|
||||
@@ -803,6 +803,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
@@ -1826,6 +1827,7 @@
|
||||
"posthog_organization"."created_at",
|
||||
"posthog_organization"."updated_at",
|
||||
"posthog_organization"."plugins_access_level",
|
||||
"posthog_organization"."session_cookie_age",
|
||||
"posthog_organization"."for_internal_metrics",
|
||||
"posthog_organization"."is_member_join_email_enabled",
|
||||
"posthog_organization"."is_ai_data_processing_approved",
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
import json
|
||||
from datetime import datetime, timedelta
|
||||
from urllib.parse import quote
|
||||
from unittest.mock import patch
|
||||
|
||||
from django.test.client import Client
|
||||
from django.urls import reverse
|
||||
from freezegun import freeze_time
|
||||
from rest_framework import status
|
||||
from django.conf import settings
|
||||
from django.core.cache import cache
|
||||
|
||||
from posthog.api.test.test_organization import create_organization
|
||||
from posthog.api.test.test_team import create_team
|
||||
@@ -618,3 +621,107 @@ class TestAutoLogoutImpersonateMiddleware(APIBaseTest):
|
||||
res = self.client.get("/api/users/@me")
|
||||
assert res.status_code == 200
|
||||
assert res.json()["email"] == "user1@posthog.com"
|
||||
|
||||
|
||||
@override_settings(SESSION_COOKIE_AGE=100)
|
||||
class TestSessionAgeMiddleware(APIBaseTest):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
cache.clear()
|
||||
# Patch time.time before login to ensure session creation time is correct
|
||||
self.time_patcher = patch("time.time", return_value=1704110400.0) # 2024-01-01 12:00:00
|
||||
self.time_patcher.start()
|
||||
self.client.force_login(self.user)
|
||||
self.time_patcher.stop()
|
||||
|
||||
def tearDown(self):
|
||||
super().tearDown()
|
||||
cache.clear()
|
||||
# Ensure any remaining patches are stopped
|
||||
self.time_patcher.stop()
|
||||
|
||||
@freeze_time("2024-01-01 12:00:00")
|
||||
@patch("time.time", return_value=1704110400.0) # 2024-01-01 12:00:00
|
||||
def test_session_continues_when_not_expired(self, mock_time):
|
||||
# Initial request sets session creation time
|
||||
response = self.client.get("/")
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(self.client.session.get(settings.SESSION_COOKIE_CREATED_AT_KEY), 1704110400.0)
|
||||
|
||||
# Move forward 99 seconds (before timeout)
|
||||
mock_time.return_value = 1704110499.0 # 2024-01-01 12:01:39
|
||||
response = self.client.get("/")
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
@freeze_time("2024-01-01 12:00:00")
|
||||
@patch("time.time", return_value=1704110400.0) # 2024-01-01 12:00:00
|
||||
def test_session_expires_after_total_time(self, mock_time):
|
||||
# Initial request sets session creation time
|
||||
response = self.client.get("/")
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(self.client.session.get(settings.SESSION_COOKIE_CREATED_AT_KEY), 1704110400.0)
|
||||
|
||||
# Move forward past total session age (101 seconds)
|
||||
mock_time.return_value = 1704110501.0 # 2024-01-01 12:01:41
|
||||
response = self.client.get("/")
|
||||
# Should redirect to login
|
||||
self.assertEqual(response.status_code, 302)
|
||||
self.assertEqual(
|
||||
response.headers["Location"], "/login?message=Your%20session%20has%20expired.%20Please%20log%20in%20again."
|
||||
)
|
||||
|
||||
@freeze_time("2024-01-01 12:00:00")
|
||||
@patch("time.time", return_value=1704110400.0) # 2024-01-01 12:00:00
|
||||
def test_org_specific_session_timeout_from_cache(self, mock_time):
|
||||
# Set org-specific timeout in cache
|
||||
cache.set(f"org_session_age:{self.organization.id}", 50)
|
||||
|
||||
# Initial request sets session creation time
|
||||
response = self.client.get("/")
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(self.client.session.get(settings.SESSION_COOKIE_CREATED_AT_KEY), 1704110400.0)
|
||||
|
||||
# Move forward past org timeout (51 seconds)
|
||||
mock_time.return_value = 1704110451.0 # 2024-01-01 12:00:51
|
||||
response = self.client.get("/")
|
||||
# Should redirect to login
|
||||
self.assertEqual(response.status_code, 302)
|
||||
self.assertEqual(
|
||||
response.headers["Location"], "/login?message=Your%20session%20has%20expired.%20Please%20log%20in%20again."
|
||||
)
|
||||
|
||||
@freeze_time("2024-01-01 12:00:00")
|
||||
@patch("time.time", return_value=1704110400.0) # 2024-01-01 12:00:00
|
||||
def test_session_timeout_after_switching_org_with_cache(self, mock_time):
|
||||
# Create another org with different timeout
|
||||
other_org = Organization.objects.create(name="Other Org", session_cookie_age=30)
|
||||
other_team = Team.objects.create(organization=other_org, name="Other Team")
|
||||
self.user.organizations.add(other_org)
|
||||
|
||||
# Set cache for both orgs
|
||||
cache.set(f"org_session_age:{self.organization.id}", 50)
|
||||
cache.set(f"org_session_age:{other_org.id}", 30)
|
||||
|
||||
# Initial request sets session creation time
|
||||
response = self.client.get("/")
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(self.client.session.get(settings.SESSION_COOKIE_CREATED_AT_KEY), 1704110400.0)
|
||||
|
||||
# Switch to other team
|
||||
self.user.team = other_team
|
||||
self.user.current_team = other_team
|
||||
self.user.current_organization = other_org
|
||||
self.user.save()
|
||||
|
||||
# Move forward 29 seconds (before new org's timeout)
|
||||
mock_time.return_value = 1704110429.0 # 2024-01-01 12:00:29
|
||||
response = self.client.get("/")
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
# Move forward 31 seconds (past new org's timeout)
|
||||
mock_time.return_value = 1704110431.0 # 2024-01-01 12:00:31
|
||||
response = self.client.get("/")
|
||||
self.assertEqual(response.status_code, 302)
|
||||
self.assertEqual(
|
||||
response.headers["Location"], "/login?message=Your%20session%20has%20expired.%20Please%20log%20in%20again."
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user