0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-12-01 04:12:23 +01:00
Commit Graph

150 Commits

Author SHA1 Message Date
Li Yi Yu
f6ace6abc7
fix(rba): Allow new feature flags to always have permissions editing (#13112)
* allow permissions setting on new flags

* move isAdminOrOwner logic to backend for flag permissions editing

* fix backend test
2022-12-03 15:15:39 -05:00
Li Yi Yu
6136515498
feat(role-based-access): Permissions table display (#13053)
* show locked feature flags on feature flags table

* disable side actions without edit permissions

* add table view for permissions on feature flag

* update permissions editing on new and in edit mode flags

* separate tabs for role access in org settings

* linter fixes

* allow all members to be added to roles

* add expandable row displaying more information

* add info about admins having full edit access always

* link to organization role access settings from feature flag
2022-12-01 20:01:22 -05:00
Raquel Smith
2f10b24a16
feat(onboarding): let people create demo project (#12877)
* Allow creating new team/project with is_demo flag

* make is_demo not read-only

* Give ppl option to create demo proj right away

* Load the demo data if it's a demo project

* Make sure the variable exists

* Add a demo tag next to demo projects in switcher

* Add a darker color to snack
so it shows up on a hovered button

* Swap bookmarklet for 'generating demo data' panel

* Finish getting rid of bookmarklet (test only)

* Show the demo flag in the main nav if Is_demo

* Update permissions to create a new proj if is_demo
and the org doesn't already have a demo proj

* If org already has a demo proj, just go there

* Add DemoProjectButton

* Don't show ingestion details if it's a demo team

* Don't show ingestion flow on demo project
I doubt people will land here, but just in case

I also renamed the ingestionLogic file name since we renamed the
logic itself previously

* Fix a couple ts errors

* Fix and write new pytests

* Don't change test strings

* Add a story for the snack

* Minor fixes

* Don't set completed_snippet_onboarding
just deal with it otherwise

* Remove the demo data option from platforms

* Change CTA to reflect existing demo project

* Only make the first button primary

* Fix ts error

* feat: prevent billing for events in demo projects (#12924)

* Don't include events in a demo proj in billing

* filter demo teams from usage reports

* Fix ts error

* Make sure demo teams actually aren't included

* take a stab at a test for this

* fix test

Co-authored-by: Emanuele Capparelli <k@emkpp.com>

* Enable master project demo data on Cloud too

* Use proper python

Co-authored-by: Michael Matloka <dev@twixes.com>

* Address review suggestions

* Remove color option from ProjectName
It was the same for all uses

Co-authored-by: Emanuele Capparelli <k@emkpp.com>
Co-authored-by: Michael Matloka <dev@twixes.com>
2022-11-29 10:45:04 -08:00
Paul D'Ambra
00139192f0
feat: pre-fill existing tags for insights, actions, event definitions, and property definitions (#12544)
* pre-fill actions tags

* pre-fill insights tags

* add event and event property definitions tags APIs and load them in UI when editing

* extend the definitionEditLogic tests a little

* add a tags endpoint

* remove per item tag api endpoints

* remove more

* start moving to tagsModel

* wiring parts together

* update tags when action is saved

* tag refresh when editing definitions
2022-11-24 23:42:26 +00:00
Li Yi Yu
862697ef83
feat: role based permissions (#12657)
* initial role and role memberships setup

* create role when org is created and role memberships when user joins

* wip for merge

* fix api tests for role

* nest roles under organization route and test fixes

* remove pdb set trace

* fix types

* remove creating default roles and role memberships for orgs and users

* add permission levels to orgs and roles

* bulk create role memberships

* leave role membership as individual api request, handle bulk creation on the frontend instead

* feature flag role access wip and migrations

* fix flag role access tests

* linter

* isort

* temp type ignore

* add access level to plugin tests

* test remove test migration safe

* test license import error fix

* delete old? org license test

* nvm we need these tests

* type ignore

* reset license plans after test

* add organization resource access model and remove access level field from regular organizations

* feat: permission return on feature flag (#12826)

* suggested permission return

* change naming

* add changes

* pass bool

* fix plugin tests

* organization resource access tests and fixes

* update can edit return with new org resource access model from feature flag

* fix tests

* add permissions to feature flag for editing

* more tests

* remove unnecessary spacing

* fix test

* add context for feature flag serializer tests

* add back workflow test step

* add organization to feature flag role access

* fix(spike): why are tests failing (#12858)

* was it because invalid id is provided?

* allow django to touch the db

* a less unexpected way of allowing access to the DB

* Revert "add organization to feature flag role access"

This reverts commit ef18b0ec8b.

* address feedback and include organization safety checks in tests

* test error fix

* test role dupe name per org

* remove third access level option

* fix migration for it

* more tests

* fix test

* feat: role based permissions UI (#12776)

* add api

* starter

* role and member creation + deletion

* working with all deletes

* add block

* working roles

* permissions tab on org settings

* org default setting

* types

* flag role assignment

* working per flag permission

* working with admin block

* types

* use restricted area component

* wrap flag resource access in different url

* restore migrations manifest

* update url endpoints

* pay gate mini org role settings

* remove view and custom edit and remove resource access creation on org creation

* add feature flag

* address feedback

* fix backend tests

* remove broken permissions setting on new feature flags

* export logic props interface

Co-authored-by: Li Yi Yu <li@posthog.com>

* type fixes

Co-authored-by: Eric Duong <eeoneric@gmail.com>
Co-authored-by: Paul D'Ambra <paul@posthog.com>
2022-11-23 20:36:29 -05:00
Emanuele Capparelli
13e8e65f95
fix: billing v2 throwing status 500 (#12930)
* fix: billing v2 throwing status 500

* added test
2022-11-23 18:30:33 +00:00
Yakko Majuri
90f1b16285
feat(ingestion): remove postgres dependency from capture endpoint (#12802)
* add support for token field in kafka message

* formPipelineEvent

* rename pipeline files according to new order

* wip team_id and anonymize ips

* conditional handlers and tests

* some plugin server fixes

* fix capture bug

* fix

* more fixes

* fix capture tests

* pipeline update

* fix + investigate database resets

* fix import order

* testing and typing updates

* add test for capture endpoint

* testing

* python typing

* plugin server test

* functional test

* fix test

* another fix

* make sure no team ids clash in tests

* fix

* add more metrics and logs

* cache nulls

* updates

* add more metrics
2022-11-23 09:55:26 -03:00
Alex Gyujin Kim
dccbde23b0
feat(recordings): static playlists (#12775) 2022-11-21 19:12:54 -05:00
Michael Matloka
f618587a22
fix: Use optimized deletion of Postgres data for projects and orgs (#12814) 2022-11-16 14:27:13 +01:00
Yakko Majuri
dbe4e936e7
feat(capture): allow overriding partition keys for the plugin server topic to use random partitioning (#12785) 2022-11-15 12:36:19 -03:00
Alex Gyujin Kim
b5e8c37ed6
feat(recordings): derived names for session recording playlists (#12737) 2022-11-11 16:30:39 +00:00
Emanuele Capparelli
074dbffd9b
fix: customer group analytics (#12670)
* fix: customer group analytics

* Update snapshots

* customer group analytics when loading user

* fix api mock

* fix snapshot

* Update frontend/src/scenes/billing/v2/billingLogic.ts

Co-authored-by: Ben White <ben@benjackwhite.co.uk>

* fix

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Ben White <ben@benjackwhite.co.uk>
2022-11-10 16:38:46 +00:00
Ben White
4d3c8d7c74
feat: Add pinned playlists and fix up some other features (#12694) 2022-11-10 16:37:56 +00:00
Ben White
c8b3579d51
feat: Rollout billing v2 (#12644) 2022-11-07 13:40:14 +00:00
Ben White
67b0538e42
fix: Fixed usage report to billing and feature flag check (#12618) 2022-11-03 19:19:14 +00:00
Marius Andra
83c2ead0b9
fix(saml): add default azure ad attributions (#12613) 2022-11-03 20:02:13 +01:00
Ben White
e17c64655c
fix: Small billing bugs (#12607) 2022-11-03 17:42:48 +00:00
Ben White
cd9a5e6d29
feat: Added billing event tracking (#12594) 2022-11-03 12:28:14 +01:00
Ben White
f529f14c89
feat: Correctly sync available features (#12538) 2022-11-03 09:22:41 +00:00
Emanuele Capparelli
8f7a1fe55c
feat: group capture customers (#12553)
* feat: group capture customers

* move it to backend
2022-11-03 10:25:50 +02:00
Eric Duong
ef17c83089
feat(feature-flags): Auto rollback beta (#12485)
* api

* add performed_rollback

* add celery task and tests

* rollback test

* remove first and last

* add sentry stuff

* basic auto rollback UI

* fix errors

* testable

* add errors rollback ui

* clean up sentry keys

* clean up some ui stuff

* add some sentry context

* update ui

* fix celery

* Update posthog/api/feature_flag.py

Co-authored-by: Neil Kakkar <neilkakkar@gmail.com>

* add sentry instructions when not enabled

* add sentry context

* merge migration

* remove unnecessary field right now and update UI to 7 day trailing average

* fix migration

* fix frontend type

* activity

* reset migratioN'

* remove default

* update test

* add feature flag

* add view for conditions and make sure insight loads

* Update snapshots

Co-authored-by: Neil Kakkar <neilkakkar@gmail.com>
Co-authored-by: Li Yi Yu <li@posthog.com>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2022-11-02 21:15:47 -04:00
Ben White
1773b80323
fix: Billing test (#12442) 2022-10-26 13:56:51 +00:00
Ben White
28d72e308d
fix: Billing check for active subscription (#12440) 2022-10-26 12:50:04 +00:00
Ben White
fea961e904
feat: Billing V2 support for enterprise billing (#12425) 2022-10-26 09:13:00 +00:00
Ben White
9e9149eb50
feat: Additonal billing-v2 improvements (#12340) 2022-10-21 11:04:14 +02:00
Ben White
49da89080b
fix: Billing V2 cache key (#12341) 2022-10-19 12:57:46 +00:00
Ben White
732e68a459
fix: Reset cached is_cloud on each test (#12337) 2022-10-19 11:57:47 +00:00
Ben White
683a4aab1a
fix: Check for active subscription to determine billing version (#12330) 2022-10-19 10:28:26 +00:00
Ben White
b4a401d532
feat: Billing V2 (#11986) 2022-10-19 08:58:36 +02:00
Karl-Aksel Puulmann
20bc4cab01
fix: Revert "chore(api): meter rate limit on team" (#12316)
Revert "chore(api): meter rate limit on team (#12006)"

This reverts commit 258cd32f54.
2022-10-18 14:19:57 +03:00
Rick Marron
258cd32f54
chore(api): meter rate limit on team (#12006)
## Problem

Take 2 on [this PR](https://github.com/PostHog/posthog/pull/11993#event-7470261128). The problem is that our rate limits should be based on `team_id` instead of an API key, and the last PR didn't handle views that didn't have a `team_id`.

## Changes

* Moves the rate_limit to be based on the `team_id` when possible
* Handles views that don't have a team_id
* Ensures the enabling/disabling of rate limits applies to all rate_limit classes (it used to only apply to the default classes)

and

* moves enabling the rate limit to an instance setting
* and adds a team id allow list for bypassing the rate limit
* and a simple cache which I think stops us hammering the reading of the infrequently changing settings

👉 *Stay up-to-date with [PostHog coding conventions](https://posthog.com/docs/contribute/coding-conventions) for a smoother review.*

## How did you test this code?

Added tests for the new cases:
* Rate limit works across a team - not just on an individual user.
* Rate limits work on views without a `team_id`
* Disabling the rate limits works


Co-authored-by: Paul D'Ambra <paul@posthog.com>
2022-10-18 09:01:07 +01:00
Marius Andra
91a43ea413
chore(actions): rename calculated events to actions, remove flag (#11864)
* chore(actions): rename calculated events to actions, remove flag

* remove even more action-event code

* remove deprecated tests

* fix cypress
2022-09-20 14:46:40 +02:00
Paul D'Ambra
41e4b3ffeb
fix: dashboard collaboration is required to change dashboard description (#11754)
* fix: dashboard collaboration is required to change dashboard description

* don't change description in tests

* listing dashboards is already nplus1

* check listing is not nplus1 when description is present

* remove nplus1 from sharing config when listing dashboards

* reduce diff

* Update snapshots

* handle optional features better

* Adds missing description test for creating a dashboard

Co-authored-by: pauldambra <pauldambra@users.noreply.github.com>
2022-09-13 10:23:05 +02:00
Guido Iaquinti
6159137e60
fix(open): use utf-8 enconding and close fd (#11698) 2022-09-07 14:03:47 +02:00
Michael Matloka
5d2ad6c7bb
chore(deps): Update black to 22.8.0 (#11596)
* chore(deps): Update `black` to `22.8.0`

* Format
2022-09-05 14:38:54 +02:00
Michael Matloka
076f369c13
refactor: Remove obsolete Zapier hook code (#11614)
* refactor: Remove obsolete Zapier hook code

* Format code
2022-09-02 10:30:35 +00:00
Neil Kakkar
6cff7aef16
fix: snapshots on master (#11611) 2022-09-01 17:24:54 +01:00
timgl
5d301aee0a
fix(debug queries): query query_log across all replicas (#11460)
* fix(debug queries): Use table distributed across cluster

* Use clusterAllReplicas
2022-08-24 13:06:39 +00:00
timgl
9116dcb253
fix: Fix and improve "Debug CH Queries" (#11150)
* fix: Fix and improve "Debug CH Queries"

* fix tests

* Update snapshots

* Update snapshots

* fix tests

* Update snapshots

* Update snapshots

* fix tests

Co-authored-by: timgl <timgl@users.noreply.github.com>
Co-authored-by: posthog-bot <posthog-bot@users.noreply.github.com>
2022-08-23 09:27:37 +00:00
timgl
b8c0a8cf5c
chore: Instrument license activation events (#10811) 2022-07-26 21:36:14 +01:00
Alex Gyujin Kim
53afdc7283
feat(data-m): add event type filter to list view (#10961) 2022-07-26 17:46:15 +00:00
Rick Marron
06570c5454
fix(recordings): add ON CLUSTER to recordings TTL statement (#10934) 2022-07-22 09:29:19 -07:00
Neil Kakkar
2b370c2d1a
fix(data-management): Allow property type updates (#10897) 2022-07-20 13:55:25 +01:00
Ben White
87c948457e
fix: Slack timing header not being parsed correctly (#10603) 2022-07-01 12:34:36 +00:00
Ben White
fdbf1580f4
feat: Added Slack link unfurling (#10587)
* Added slack signature validation

Co-authored-by: Paul D'Ambra <paul@posthog.com>
2022-07-01 12:07:15 +02:00
Ben White
f4e64b07a5
feat(sharing): Insight Sharing / Embedding (#10536)
* Added SharingConfiguration
* Added SharingModal for Insights
* Simplified insight permission check
* Merged sharing/exports/embed into one view
* Removed share_token usage wherever possible

Co-authored-by: Marius Andra <marius.andra@gmail.com>
Co-authored-by: benjackwhite <benjackwhite@users.noreply.github.com>
2022-06-30 11:58:58 +00:00
Guido Iaquinti
c51b08b946
fix(misc): remove variable allocation when not needed (part #3) (#10508)
* fix(misc): remove variable allocation when not needed (part #3)

* fix(misc): remove variable allocation when not needed (part #3)
2022-06-27 19:26:09 +02:00
Guido Iaquinti
698baf61db
fix(misc): remove variable allocation when not needed (part #2) (#10502) 2022-06-27 12:21:01 +02:00
Alex Gyujin Kim
8da7cf9a2a
feat(data-management): rename actions to events frontend (#10139)
* first take

* add columns

* replace actions with events

* all actions to events

* attempt to add backend tests

* create merged event_definition and action sql

* rename calculated events to events and events to raw events

* remove all frontend changes

* reformat

* flake

* Revert "remove all frontend changes"

This reverts commit ccae916ed1.

* add action fields

* edge cases

* fossify

* bring where conditions into subquery

* bring order into query

* revert organization

* ci

* fix: remove enterpriseeventdefinition and enterprisepropertydefintion from barrel file to be foss compatible

* unfossify

* imports

* fix imports

* fix tests

* fix wrong test case

* mypy

* fix tests

* fix mypy

* prettify

* fix mounting order of logics

* address feedback and fix action ordering bug

Co-authored-by: eric <eeoneric@gmail.com>
2022-06-24 14:26:31 +00:00
Ben White
925a54b5ad
feat: Slack Invite message (#10478)
* feat: Slack Subscription Invites
2022-06-24 15:18:34 +02:00