0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-28 09:16:49 +01:00
Commit Graph

50 Commits

Author SHA1 Message Date
Julian Bez
34d0da70d9
chore(deps): Upgrade mypy, stubs, and ruff (#24500)
Also remove type annotations for Django fields, due to updates to the 
stubs and possibly to mypy they are actively unhelpful now.
2024-08-22 09:42:25 +00:00
Bianca Yang
9dd22a3757
feat: Deprecate available_features pt 2 (#22373)
* everything except plugin server and sync_available_features

* sync_available_features_done, some plugin_server done?

* and a tiny bit more

* linting

* try to fix some tests

* more test fixes/

* clean up typos

* weed wacking bugs

* more test shenanigans

* fix plugin server

* actually fix plugin server test?

* still fixing tests

* another attempt

* some pr feedback

* small fix

* fix database query accessor

* fix functional tests

* fix tests

* Update query snapshots

* Update query snapshots

* Update query snapshots

* update some comments and fxn names

* fix plugin server test

* Update query snapshots

* Update query snapshots

* Update query snapshots

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-05-28 17:29:24 -07:00
Raquel Smith
b52532c567
chore: remove team collab feature (#22170)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-05-08 13:00:02 -07:00
Julian Bez
9576fab1e4
chore: Add Pyupgrade rules (#21714)
* Add Pyupgrade rules
* Set correct Python version
2024-04-25 08:22:28 +01:00
Julian Bez
a0fc086175
chore(deps): Upgrade ruff (#21648) 2024-04-19 14:19:10 +02:00
Raquel Smith
a018d0a8a0
feat: add feature gating for teams plan (#20435) 2024-03-04 07:07:09 -08:00
Juraj Majerik
944f066f52
feat(experiments): remove paywall (#20445) 2024-02-21 14:52:48 +01:00
Ben White
7f174faf40
feat: Celery tasks refactor (#19827) 2024-01-18 14:28:10 +01:00
Tom Owers
5513be7731
chore: upgraded Ruff linter (#18188)
* Upgraded Ruff linter

* Formatted whole codebase with new ruff rules

* Revert import removal

* Fixed mypi issues or added ignores

* Fixed schema formatting

* Fixed hogvm failing tests

* Remove duplicate key in list
2023-10-26 12:38:15 +02:00
Raquel Smith
abcfdab281
chore: swap google_login key for social_sso (#17634)
swap google_login key for social_sso
2023-09-27 13:06:51 -07:00
Ben White
4783dec288
chore: Step 1 to remove posthog-cloud repo (#15898) 2023-06-15 10:33:19 +02:00
Ben White
cb7e7d5e5e
feat: Added performance API (#13452) 2023-01-06 09:51:51 +01:00
Ben White
f722886078
feat: Recording export / file playback (#13089) 2022-12-02 17:20:21 +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
Ben White
b337e29227
fix: Added missing available feature for old billing (#12786) 2022-11-15 15:19:59 +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
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
1c96763bf0
feat(app-metrics): Set up schema and data gathering of app metrics (#12143)
* Add new app_metrics feature available on scale and enterprise

* chore(ingestion): cache available_features for a longer period in OrganizationManager

This will come in handy for app metrics and is generally a performance win

* Add service to track app metrics

* refactor(historical-exports): Move retry limit handling code to same place as other error handling

* Track app metrics in processEvent/onEvent/exportEvents and historical exports

* Add mising app-metrics file

* Add missing __init__.py module

* Use correct topic + columns for app metrics

* Add a placeholder schema

* Set timestamp correctly

* Fix a typeerror in organization-manager.ts

* Schema fixup

* Add test showing read-own-writes logic

* Remove unneeded TODO

* Add missing constant

* Simplify flushing logic

* Stabilize VM tests

* Use correct sharding key

* Revert hooks changes
2022-10-12 11:30:58 +03:00
Ben White
aafcbf0b4d
fix: Moved most subscriptions code to EE (#10411)
* fix: Moved most subscriptions code to EE
* Fixed Storybook for Subscriptions
2022-06-22 14:26:13 +02:00
Marcus Hyett (PostHog)
0305c4ac5b
feat(whitelabel-shared-dashboard): Hide branding on shared dashboards paid (#9849)
* Ability to hide branding on shared dashboards for paid organizations

* Fix ts formatting

* added white labeling to min plan type
2022-05-20 02:04:41 +10:00
Eric Duong
bc1914a3e4
chore: add scale paywall to lifecycle and sequence cohort options (#9820)
* chore: add BEHAVIORAL_COHORT_FILTERING

* chore: cleanup

* add license mapping
2022-05-17 13:51:26 -04:00
Michael Matloka
624c958248
fix(licensing): Show correct active (or last active) license (#9575)
* Slightly clean up `License` model code

* Fix `relevantLicense` and type license API requests

* Create licenseLogic.test.ts

* Update comments

* Clarify test licenses with comments

* Fix typing
2022-04-29 10:27:06 +02:00
Michael Matloka
57ccb0dc66
fix(licensing): Use most recently activated license instead of least (#9461)
* fix(licensing): Use most recently activated license instead of least

* Ignore mypy

* Sort in Python instead of DB

* Fix import paths

* Update `first_valid` comment
2022-04-20 13:33:41 +02:00
Paolo D'Amico
88f8374443
feat(sso): verified domains frontend (#9065) 2022-03-18 12:32:44 +01:00
Michael Matloka
09c9f9d2f7
Dashboard permissions upsell two (#8614)
* Use LemonSelect for Template

* Add mini pay gate for dashboard permissions

* Use "advanced permissioning" instead of "collaboration features"

* Rename "Collaboration restrictions" to "Collaboration settings"
2022-02-16 20:36:36 +00:00
Alex Gyujin Kim
459d304e95
Part 1: Make everything taggable Backend (starting with Actions) (#8528) 2022-02-13 22:19:53 -08:00
Paolo D'Amico
df49e7ae77
Experimentation pay gate (#8169) 2022-01-21 09:54:48 -06:00
Paolo D'Amico
2654bb3a34
Release multivariate flags (#7650) 2021-12-16 11:10:29 -06:00
Karl-Aksel Puulmann
d8a3b9e89f
Groups: Introduction banner and empty state in persons page (#7520)
* Add group analytics to list of paid features

* Add team-level property for if any group types exist

* WIP: Groups introduction page

* Finish initial empty state page

* Hide upsell if not CH or flag not live

* Extract upsell-related logic into a separate logic to avoid loading data unless needed

* Extract upgradeLink

* Extract announcement logic

* Overcomplicate announcements

* Show initial groups announcement.

* Vary banner content according to groups access status

* Clean up access logic

* Misc announcements improvement

* Add a feature flag for groups announcement given docs are not yet ready

* Keep color for visited button links

* Get groupsList logic tests working

teamLogic <-> userLogic test connection needed to be severed alongside
this
2021-12-09 08:37:39 +02:00
Tim Glaser
1d7477f512
Make project based permissioning an enterprise feature (#7163) 2021-11-17 08:08:31 -06:00
Neil Kakkar
5963a93d15
Introduce pay gate for correlation analysis (#6720)
Co-authored-by: Marcus Hyett (PostHog) <85295485+marcushyett-ph@users.noreply.github.com>
Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
2021-11-03 11:41:16 -06:00
Paolo D'Amico
4248d52800
Paths pay gate (#6463)
* create new advanced feature

* remove all advanced features

* pay card basic

* dismiss pay gate

* pay card story component

* address feedback

* restricted paths step too
2021-10-18 09:17:54 +02:00
Tim Glaser
fbb805be8f
Add scale plan in license.py (#6416) 2021-10-14 15:13:37 +03:00
Michael Matloka
bc3e223265
Project-based permissioning framework (#5976)
* Refactor `AvailableFeature` from strings to an enum everywhere

* Fix circular dependency and type

* Add "Per-project access" feature flag, premium feature, and organization switch

* Rename `OrganizationMembershipLevel` to `OrganizationAccessLevel`

* Create `ExplicitTeamMembership` model

* Show whether projects are restricted in the project switcher

* Update organizations API code

* Fix migrations

* Move organization tests that require EE to `ee`

* Revert `OrganizationMembershipLevel` rename

* Fix organization tests

* Update migration

* Fix schema and add Members to Project Settings

* Build out test memberships API with security tests

* Update `TeamMembers` and `teamMembersLogic`

* Move "Per-project access" description to tooltip

* Add moar tests

* Fix Project Members list logic

* Add additional membership checks

* Update migrations

* Fix typing

* Adjust explicit team memberships API similarly

* Fix typo

* Unify `ExplicitTeamMemberSerializer`

* Remove old changes to `membersLogic` usage

* Use `effective_membership_level` on `TeamBasicSerializer`

* Clean up organization update tests

* Explicitly disallow enabling per-project access for free

* Fix circular import

* Remove `id` from `UserSerializer`

* Fix typing

* Try to fix import

* Fix fatal typing

* Add more tests

* Update permissioning.ts

* Add clarifying comment to migration

* Fix import

* minor clarifications

* Revert `TopNavigation` changes

* Make new access control entirely project-based

* Update migrations

* Add `project_based_permissioning` to `TeamBasicSerializer`

* Update test_team.py

* Fix Access Control restriction tooltip

* adjust copy & UI a bit

* Address feedback on field comment

* "Privacy settings" to "Access Control"

* Ignore mypy

* Rename `Team` field `project_based_permissioning` to `access_control`

* Update migrations

Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
2021-09-22 18:29:59 +02:00
Michael Matloka
1d4187923b
Refactor AvailableFeature from strings to an enum everywhere (#5856)
* Refactor `AvailableFeature` from strings to an enum everywhere

* Fix circular dependency and type
2021-09-09 12:19:55 +02:00
Paolo D'Amico
627d493817
SAML support (#5681) 2021-08-27 07:20:49 -07:00
Tim Glaser
b821b845a6
Remove free clickhouse license (#4788) 2021-06-17 16:47:04 +03:00
Li Yi Yu
7546e3ea0a
Event properties taxonomy (#4486)
* add description and tag fields to event and property definitions

* set up description and tagging on models

* frontend functionality for description editing

* connect backend and kea logic for description editing

* update event and property definitions model and migration

* delete set null instead of cascade

* migration merge fix

* add owner column

* undo posthog event property taxonomy migrations

* set up definitions on enterprise level

* allow enterprise definitions description editing

* fix licensing conditions and add tests

* proper get and update methods for the multi inheritance table and new column fields for enterprise event model

* check for license to separate routes

* migrate existing definitions to ee definitions tables and render ee vs non-ee definition views based on existing feature conditional

* all the working backend updates

* updated tests

* frontend fixes and linting updates

* feature flag it
2021-06-03 09:22:16 -04:00
Michael Matloka
eaf2459724
Save Organization.available_features as a DB column (#4426)
* Save Organization.available_features as a DB column

* `update_available_features()` before an organization is created too

* Run the task half past the hour

* Adjust tests and fix available_features sync on start

* Remove redundant null=False

* Fix `Organization.update_available_features()`

* Run Cloud tests in respect to `posthog-cloud` `4426-fix` branch

* Revert "Run Cloud tests in respect to `posthog-cloud` `4426-fix` branch"

This reverts commit 421e8541b3.
2021-05-24 22:17:01 +02:00
Karl-Aksel Puulmann
56cc0ddc22
Rename free clickhouse plan (#4203) 2021-05-04 06:06:26 -07:00
Tim Glaser
5cfbc49cc3
Add clickhouse and max users to license (#3918)
Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
2021-04-14 08:45:39 -07:00
Paolo D'Amico
da61c55666
Description & tagging on dashboards (#3756) 2021-03-26 17:38:13 -07:00
Michael Matloka
86c0c1af91
Make Google login an Enterprise/Cloud feature (#2501)
* Make Google login an Enterprise OR Cloud feature

* Fix test

* isort

* Fix typing

* Restore package.json
2020-12-04 19:54:27 +01:00
Paolo D'Amico
6426408c6a
remove legacy cloud billing info from ee (#2537) 2020-11-29 11:09:25 +00:00
Paolo D'Amico
b6ad72fc52
adds features to cloud plans (#2357) 2020-11-12 21:43:06 +00:00
Michael Matloka
533c7df105
Organization<>Team<>User structure (closes #1540) (#1562)
* Backend changes to implement #1461

* Added the missing migration files

* Fixes Typecheck errors

* Refactor request.user.team_set.get() to use request.user.team

* Updated user patch method to change current_team on team id instead of name

* Merged migration file

* Changes team property to return first item in queryset

* Fixes failing tests

* Changed User api to return the ids of the teams they are currently part of

* Frontend for changing teams

* Update and simplify migrations

* Improve team and user buttons

* Make team changing backend more logical

* Improve current_team mechanics

* Update test_team.py

* Fix Team.objects.create_with_data

* Update migration

* Update tests

* Make setup_review more convenient

* Add Organization and OrganizationMembership

* Replace is_admin with level

* Extend API

* Update team.py

* Improve modeling

* Improve handling of new mechanics

* Add proper migration

* Remove _ensure_organization_and_team

* Update 0084_org_team_user.py

* Improve user, org and team creation

* Make MembershipLevel more flexible for the future

* Add member deletion

* Fix naive datetime warnings

* Update setup_review.py

* Update API route

* Make PersonalAPIKey changes

* Update models and migrations, fix typing

* Fix typing

* Use MAC-less UUID v1 instead of v4 for better performance

* Add abstract UUIDModel

* Update utils.py

* Update utils.py

* Fix multi/unicast bit

* Update APIs, frontend and tests

* Update pull_request_template.md

* Fix comment

* Fix migration error

* Compress migrations

* Updates with minimal renaming

* More updates

* Make further updates

* Update test_team_user.py

* Fix issues

* Add migration

* Satisfy mypy

* Remove Signup redirect on logged in

* Use uuid1_macless in Person

* Fix typing

* Update tests

* Update /api/team/signup to /api/organization/signup

* Fix mypy issues and update tests

The remaining failures are actually missing functionality (TDD applied), so filling these in.

* Update 0086_org_live

* Make small improvements

* Implement permissions

* Remove now unneccesary membership check

* Update setup_dev.py

* Make small frontend improvements

* Add drf-nested-routers as requirement

* Remove unused import

* Implemented nested routes

* Remove cruft

* Add relevant org/proj/user name to headings

* Fix imports

* Update migration

* Replace unreliable drf-nested-routers with drf-extensions

* Improve unset team handling

* Make org and team creation proper

* Update migration

* Fix migration

* Update TopContent

* Update command palette for new sidebar structure

* Remove deprecated demo data deletion

* Assume that each org has a project and fix typing

* Require paid plan for multiple orgs and projects

* Make HogFlix demo a separate team

* Update migration

* Slightly improve style

* Adjust page layout bottom padding

* Make user dropdown nicer

* Fix base app tests

* Satisfy mypy

* Fix test_leave_organization

* Improve wording

* Possibly fix import

* Remove misplaced None check

* Enhance org and teams APIs and add tests

* Fix /api/projects for particular Team

* Improve invites and demo data

* Address feedback

* Put everything related to billing on Organization

* Fix minor issues

* Simplify invitation creation

* Update team model

* Make orgs and projects premium only on self-hosted

* Improve testing

* Update migration

* Remove extra License import

* Fix minor issues

* Fix Django tests

* Fix Cypress

* Fix yarn build

* Fix TeamSignupViewset

* Fix posthog-production incompatibility

* Remove extraneous insight endpoint registration

* Adjust tests for posthog-production

* Simplify invitations and fix email validation

* Address all feedback

* Satisfy mypy

* Update migration

* Fix constraint removal in migration

* Update tests

* Fix test creation edge case

* Run posthog-production CI tests against this branch and teams-live

* Ensure that js_posthog_api_key is always passed

* Fix preflight check pre-login

* Update cypress tests

* Update instanceStatus.js

* Bring ee tets up to par

* Bring actions-ux-201012 back

* Cypress retry in cypress.json

* Revert "Run posthog-production CI tests against this branch and teams-live"

This reverts commit d79cb844d8.

Co-authored-by: anna <ms.annaphilips@gmail.com>
Co-authored-by: Anna Philips <aphilips@matmacorp.com>
2020-10-22 10:58:32 +02:00
Tim Glaser
764bdbd0ff
Fix license issues (#1511)
* Fix license issues

* fix(license): fix license tests

Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
2020-08-26 15:53:24 +02:00
Michael Matloka
c040601f49
Personal API keys and Zapier integration (#1281)
* Add missing migration

* Add generate_random_token() model util

* Move PublicTokenAuthentication to utils

* Make use of generate_random_token

* Add User.personal_access_token field

* Add PersonalAccessTokenAuthentication

* Fix PublicTokenAuthentication

* Fix migration and auth import

* Add personal_access_token to user API

* Update Setup.js

* Support trailing slash in API

* Improve PAT auth quality

* Add django-rest-hooks requirement

* Update settings.py for rest_hooks

* Fix django-rest-hooks requirement

* Bring back API routes with no double trailing slash

* Rename posthog.api.team to team_user

* Add API TODO

* Ad PAT auth with X-PAT HTTP header

* Replace User.personal_access_token with PersonalAPIKey model

* Fix PersonalAPIKey max_lengths

* Describe posthog.models.utils.generate_random_token better

* Add personal_api_key to API

* Add authenticate_header to PersonalAPIKeyAuthentication

* Add hook API endpoint

* Use django.utils.timezone in place of datetime.datetime

* Add Personal API Keys to Setup

* Sort personal_api_keys in ORM

* Add Action.on_perform()

* Remove requirements.txt comment

* Add a

* Add REST hook tasks

* Optimize PersonalAPIKeyAuthentication query

* Add a trailing slash version of /e endpoint

* Add team field to PersonalAPIKey model

* Add personal API key support to capture endpoint, get_cached_from_token

* Reject personal API keys from inactive users

* Add extra_properties_json field to /capture

* Improve PAK auth header regex

* Use custom hook model

* Deliver hooks

* Handle action.on_perform

* Consolidate userLogic in userLogic.tsx

* Update PersonalAPIKeys.js

* Make PersonalAPIKey foreign keys read-only

* Update requirements/dev.txt

* Make PersonalAPIKeys TSX

* Fix conflict

* Fix migration

* Fix minor mishaps

* Update and fix tests

* Use CharField of random 32 bits as hook.id

* Fix conflicting migrations

* Fix ValidationError in HookSerializer.validate_event

* Use query param in /api/event/actions ID filtering

* Rename endpoint `hook` to `hooks`

* Satisfy mypy

* Add tests

* Use DRF serialization in action_defined and annotation_created triggers

* Update migration leafs

* Make mypy ignore rest_hooks

* Update Django signal receiver names

* Update TS dependencies

* Revert "Update TS dependencies"

This reverts commit 7fc26fefcd.

* Add field user to Hook model

* Update migration leafs

* Fix circular import

* Fix some code

* Install git before running pip install in Dockerfiles

* Improve personal API keys UI

* Satisfy mypy

* Reword key label placeholder

* Add personal API key support to /api/user/*

Unfortunately these endpoints are still limited by CSRF protections at the moment, so not accessible outside PostHog itself.

* Improve PersonalAPIKeyAuthentication and add CsrfOrKeyViewMiddleware

* Run collectstatic before test

* Don't install dev dependencies in CI

* Update dependency installation order in CI

* Fix bug and describe PersonalAPIKeyAuthentication

* Fix CI issues

* Fix typing issues

* Fix more typing issues

* Use /api/personal_api_keys to list keys

* Move REST hooks (and therefore Zapier) to ee/

* Refactor personal API logic with kea-loaders

* Add "More about API authentication in PostHog docs."

* Update PersonalAPIKeys.tsx

* Use TestMixin

* Fix "Authentication" that should've been "Authorization"

* Add option to skip self.client.force_login in API tests

* Include team_id and user_id in personal API key serialization

* Update test_hooks.py

* Add personal API key tests

* Remove leftover

* Make ee.settings override posthog.settings

* Don't directly import from models

* Remove unused imports

* Fix mypy issues

* Fix HOOK_DELIVERER

* Use decorator for /api/user PAK auth

* Don't fire REST hook if user doesn't have "zapier" feature

* Import Optional

* Reword to "premium Zapier"

* Make mypy happy

* Fix test_delete_personal_api_key

* Fix misclick

* Fix and test /capture with personal API key

* Make mypy happy

* Remove extra_properties_json

* Resolve migrations

* Remove apt-utils

* Optimize and test PAK user.is_active filtering

* Replace DEBUG true with 1

* Remove unused instance_id

* Improve typing

* Fix deletion toast

* Refactor CopyToClipboard and use it in PAKs

* Use toast.success

* Update migrations

* Fix migration

* Fix migrations

* Complete merge

Co-authored-by: Tim Glaser <tim@glsr.nl>
2020-08-26 10:34:57 +02:00
Tim Glaser
23f5918477
Add enterprise edition and licensing (#1390)
* Add enterprise edition and licensing

* Cypress test

* License wording change

* Fix typos
2020-08-14 11:23:55 +02:00