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

13 Commits

Author SHA1 Message Date
Karl-Aksel Puulmann
7de761dff0
Update BE tracking to use groups (#7355)
* Update some posthoganalytics.capture calls

* Update report_user_logged_in tracking

* Update report_team_member_invited

* Update report_bulk_invited

* Update report_org_usage

* Update AnalyticsDestroyModelMixin

* Update action creation/updating tracking

* Update annotations tracking

* Update cohort tracking

* Update dashboards tracking

* Update feature flags tracking

* Update imports, sessions tracking

* More typeignores

* Default properties blank

* update metadata default

* Stringify

* Fix some tests

* Kill debug code

* Update FF tests

* Update test_organization

* Update test_organization_invites

* Update test_user

* Fix org usage report

* update test_send_license_usage

* Update organization tests

* Respect dry-run on errors as well, log

* Update organization properties on report

* Assert organization props

* Remove dead imports

* Fix test
2021-11-30 10:58:37 +02:00
Michael Matloka
ec0f7ef880
Add slug field to Organization (#6395)
* Add `slug` fields to `Organization` and `Team`

* Expose slugs to user

* Add slug autogeneration for new orgs/projects

* Improve slug UX

* Remove slug from settings

* Update org/team instance creation plus add tests

* Only require project slug to be unique for org, not globally

* Fix `get_prep_value`

* Test organization slugification

* Deslugify `Team`

* Clean up changes

* Update test_user.py

* Apply suggestions from code review

Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>

* Random 4 letter suffixes for the win

* Fix import

* Ignore `test_migrations_are_null`

* Fix `RunSQL` query being empty

* Fix `generate_random_short_suffix` testing

Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
2021-10-13 14:09:40 +02: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
e48bd8b08b
Allow "new member" email opt-out (#5430) 2021-08-04 18:09:41 -07:00
Paolo D'Amico
7ea9eb692c
Update Django to 3.1.8 (and related) (#4007) 2021-04-19 12:59:10 -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
29bf59cc2b
Backend tests refactor (#3774) 2021-03-31 19:00:58 -07:00
Michael Matloka
e50d5912e5
Add organization settings (#3324)
* Add organization settings

* Update test_organization.py

* Fix TS issues

* Improve permissioning frontend

* Fix an import

* minor typos

* fix cypress

* Make use of AnalyticsDestroyModelMixin

* Solve nits

* Rework Invites empty state

* Update organization test

* Improve organization tests and permissioning

* Polish Organization Settings frontend

* Improve Members UX

* Use RestrictedArea in Project Settings

* Fix APITestMixin._create_user

* some minor copy adjustments

* Use email initial in ProfilePicture

* Clean up org deletion tests

* Improve org/project deletion UX and reliability

* Enhance org deletion test

Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
2021-03-10 13:09:35 +01:00
Paolo D'Amico
de317c8e87
Bulk invite team members (setup section II) (#3143)
Co-authored-by: Michael Matloka <dev@twixes.com>
2021-02-03 13:03:22 +01:00
Michael Matloka
5d5ede19e4
Fix REST hook firing (#2894)
* Fix REST hooks being only fired if project has webhook

* Fix firing more

* Actually still filter but also for Zapier

* Don't .only() Team in EE process_event to optimize REST hook firing

* Fix REST hook duplication in EE

* Update test_process_event.py

* Debug

* Revert "Debug"

This reverts commit 6d4c9f754d.

* Fix organization-less teams partly

* Fix more organization-less teams

* Fix moar organization-less teams

* Explicitly bootstrap org without user in tests

* Fix org bootstrap

* Fix typing

* Fix bootstrap usage

* Update test_process_event.py

* Fix num queries

* Add test_action_on_perform_hook_fired_once

* Fix Action.objects.create call

* Don't test hook firing as it's offloaded to worker
2021-01-12 13:09:27 +01:00
Michael Matloka
96e4ee8512
Nest endpoints of project-based models under /api/project/ – LITE (#2485)
* Nest endpoints under /project/ with StructuredViewSetMixin

* Rewrite URLs

* isort

* Update utils.py

* Fix errors

* Fix almoast all the errors

Last left to do: shared dashboards and permission classes.

* isort

* Adjust for master

* Add compatbility with shared dashboards

* Debug ClickHouse

* Remove some # type: ignores

* Simplify CursorPagination

* Move test base from posthog.api.test to posthog.test

* Improve API structure

* Bring back legacy endpoints

* Fix legacy compatibility

* Fix bugs and typing

* isort

* Fix hooks test

* Try fixing errors

* Fix oversight

* isort

* Fix problems

* isort

* Be more tolerant

* Fix naming and remove redundant code

* Fix imports

* Update deleteWithUndo

* Roll back

* Roll back more

* Update .gitignore

* Rollll back

* Rollllllll

* back

* Betterify

* Address feedback
2020-11-24 23:26:28 +01:00
Michael Matloka
d24783ece6
Org/projects UX enhancements (#2145)
* Improve member removal UX

* Add Delete Project

* Constrain project deletion in the frontend

* Improve no org

* Make minor fixes

* Bring back changes

* Add member level changing

* Update test_organization_members.py

* Fix org leaving edge case

* Polish Project Settings UI

* Allow full project deletion

* Fix dynamic page title edge case

* Mymymypy

* Remove console.log

* Remove obsolete test

* Fix API constraints

* Fix invite creation validation case

* Add cloud/self-hosted specificity to premium feature guarding

* Improve user setting logic in case of error

* Use Teammates instead of Team Members

* Improve org/project creation UX

* Add organization ownership

* Add migration

* Fix redirecting to org creation

* Improve clipboard toast consistency

* isort

* Update tests

* isort

* Update test_organization.py

* Fix typing (somewhat)

* Explain passing on ownership

* Address feedback

* Reverse guardPremiumFeature return

* Fix typing

* Fix test

* Fix last typing

* Fix merge conflict resolution

* Remove unused code
2020-11-23 10:53:45 +01: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