* Use ruff formatter
Ruff is now also a formatter! And it runs in a fraction of a second
across our whole codebase vs "I waited more than 30s and cancelled it
because I got bored".
* Config and command -> ruff
* Run 'ruff format .'
* Update query snapshots
* Run 'ruff format .'
* Fix format after commit hook
* Update query snapshots
* Fix type error - ignore comment moved
* Exclude hogql grammar from formatting and reverted grammar
* Run format
---------
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Tom Owers <tom@paace.co>
* Get #team_effective_membership_level under test
* Extract method into class
* Refactor team_effective_membership_level to require less lookups
* Test and scaffolding for dashboard methods
* Move dashboard methods to user_permissions
* Optimize dashboard methods
* Insights priviledge logic to user_permissions
* Make insight priviledge code efficient
* Fix bug to improve efficiency
* Refactor efficiency tests
* Use UserPermissions in some dashboard-related views
* Use UserPermissions in some insight-related views
* Fix a typo
* Remove insight, dashboard model methods
* Experiment: make shared dashboards not have effective_priviledge_levels/effective_restriction_level
* Remove team#get_effective_membership_level
* Simplify TeamBaseSerializer
* Update organization API
* Update UserViewSet
* update team view
* Reduce some lookups
* Make UserPermissions not dependant on organization being passed
* cast-to-user
* Test listing with basic as FE calls it
* Update dashboard views
* JOIN organizations table, dont rely on request.user.organization
* Update snapshots
* Handle shared dashboards slightly better
* Simplify team API
* Fix test_team.py
* Update middleware tests
* Update ee team tests
* Fully refactor a problematic call pattern
* Solve ee API errors
* Solve lint fails
* Reset in insights as well
* Cast
* Update snapshots
* Update snapshots
* Update snapshots
* Update snapshots
* Update snapshots
* Update snapshots
* Remove merge conflict
* Update snapshots
* Remove items
---------
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
* 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
* Revert `TopNavigation` changes
* Restore `TopNavigation` changes
This reverts commit 05fd9e4ed6.
* Try to add a story for `TopNavigation`
* minor clarifications
* Revert `TopNavigation` changes
* Restore `TopNavigation` changes
* Make new access control entirely project-based
* Update migrations
* Add `project_based_permissioning` to `TeamBasicSerializer`
* Update test_team.py
* Fix `isRestricted` in `ProjectRow`
* Disable project creation for non-admins
* Make project icon in top nav itself dynamic as well
* Fix story
* Delete 0169_project_based_permissioning.py
* Apply suggestions from code review
Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
* Update frontend/src/layout/navigation/TopNavigation.tsx
Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
* Address feedback
* Project-based permissioning full data access restrictions (#6068)
* Fix Access Control restriction tooltip
* Add `TeamMemberAccessPermission` and use it in viewsets
* Add `ErrorProjectUnavailable` scene
* Ignore mypy
* Update MainNavigation.tsx
* Update explicit_team_member.py
* Fix frontend detection of unavailable project
* Fix some tests and edge cases
* Fix basic permissions
* Add more tests
* Simplify `ExplicitTeamMemberViewSet` permissions
* Improve restrictions and add moar tests
* Update frontend
* Fix a couple of things
* Fix import
* Fix some edge cases
* Fix typing errors
* Use hedgehog instead of moth
Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
* Address feedback
* Add proper permissioning to dashboard views
* Update ee/api/test/test_dashboard.py
Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
* Run prettier
* Remove debug code
Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
* 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
* Revert `TopNavigation` changes
* Add project member addition button+modal
* 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
* minor improvements
* fix frontend typing
* Fix frontend typing a bit more
* adjust copy & UI a bit
* Address feedback on field comment
* "Privacy settings" to "Access Control"
* Make `FusedTeamMemberType` comment clearer
* Remove useless `export`
* Delete 0169_project_based_permissioning.py
* Clean some code up a bit
* Project-based permissioning member removal (#6067)
* Fix `teamMembersLogic` loaders
* Allow explicit project members to leave
* Add member removal/leaving button to Members with Project Access
* Restore error message
* Fix error message
* Correct things
Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>