Repository navigation
feat: allow reading github integrations with personal API key #38921
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
Changes from all commits
245a5d8
281cc53
f0f2aab
3f21576
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,7 @@ | |
| from posthog.api.routing import TeamAndOrgViewSetMixin | ||
| from posthog.api.shared import UserBasicSerializer | ||
| from posthog.api.utils import action | ||
| from posthog.auth import PersonalAPIKeyAuthentication | ||
| from posthog.models.instance_setting import get_instance_setting | ||
| from posthog.models.integration import ( | ||
| ClickUpIntegration, | ||
|
|
@@ -154,10 +155,16 @@ class IntegrationViewSet( | |
| mixins.DestroyModelMixin, | ||
| viewsets.GenericViewSet, | ||
| ): | ||
| scope_object = "INTERNAL" | ||
| scope_object = "integration" | ||
| scope_object_read_actions = ["list", "retrieve", "github_repos"] | ||
| queryset = Integration.objects.all() | ||
| serializer_class = IntegrationSerializer | ||
|
|
||
| def safely_get_queryset(self, queryset): | ||
| if isinstance(self.request.successful_authenticator, PersonalAPIKeyAuthentication): | ||
| return queryset.filter(kind="github") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we want to only return github integrations?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know how diligent people have been when separating |
||
| return queryset | ||
|
|
||
| @action(methods=["GET"], detail=False) | ||
| def authorize(self, request: Request, *args: Any, **kwargs: Any) -> HttpResponse: | ||
| kind = request.GET.get("kind") | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,6 +28,7 @@ | |
| "group", | ||
| "hog_function", | ||
| "insight", | ||
| "integration", | ||
| "link", | ||
| "named_query", | ||
| "notebook", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add some permissions tests here?