Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: check for the organization id #26515

Merged
merged 11 commits into from
Nov 29, 2024
5 changes: 4 additions & 1 deletion frontend/src/layout/ErrorProjectUnavailable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Link } from '@posthog/lemon-ui'
import { useValues } from 'kea'
import { PageHeader } from 'lib/components/PageHeader'
import { useEffect, useState } from 'react'
import { CreateOrganizationModal } from 'scenes/organization/CreateOrganizationModal'
import { urls } from 'scenes/urls'
import { userLogic } from 'scenes/userLogic'

Expand Down Expand Up @@ -42,7 +43,9 @@ export function ErrorProjectUnavailable(): JSX.Element {
return (
<div>
<PageHeader />
{user?.team && !user.organization?.teams.some((team) => team.id === user?.team?.id) ? (
{!user?.organization ? (
<CreateOrganizationModal isVisible inline />
) : user?.team && !user.organization?.teams.some((team) => team.id === user?.team?.id) ? (
<>
<h1>Project access has been removed</h1>
<p>
Expand Down
2 changes: 1 addition & 1 deletion posthog/rbac/user_access_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def _access_controls_filters_for_queryset(self, resource: APIScopeObject) -> dic

if self._team and resource != "project":
common_filters["team_id"] = self._team.id
else:
elif self._organization_id:
common_filters["team__organization_id"] = str(self._organization_id)

return common_filters
Expand Down
Loading