Ejemplo n.º 1
0
    def get(self, request, organization):
        has_gitlab = features.has('organizations:gitlab-integration',
                                  organization,
                                  actor=request.user)
        has_jira_server = features.has('organizations:jira-server-integration',
                                       organization,
                                       actor=request.user)

        has_catchall = features.has('organizations:internal-catchall',
                                    organization,
                                    actor=request.user)
        providers = []
        for provider in integrations.all():
            if not has_gitlab and provider.key == 'gitlab':
                continue
            if not has_jira_server and provider.key == 'jira_server':
                continue
            if not has_catchall and provider.key in settings.SENTRY_INTERNAL_INTEGRATIONS:
                continue

            providers.append(provider)

        providers.sort(key=lambda i: i.key)

        serialized = serialize(
            providers,
            organization=organization,
            serializer=IntegrationProviderSerializer(),
        )

        return Response({'providers': serialized})
Ejemplo n.º 2
0
    def get(self, request, organization):
        has_catchall = features.has('organizations:internal-catchall',
                                    organization,
                                    actor=request.user)
        has_github_apps = features.has('organizations:github-apps',
                                       organization,
                                       actor=request.user)

        providers = []
        for provider in integrations.all():
            internal_integrations = {
                i
                for i in settings.SENTRY_INTERNAL_INTEGRATIONS
                if i != 'github' or not has_github_apps
            }
            if not has_catchall and provider.key in internal_integrations:
                continue

            providers.append(provider)

        providers.sort(key=lambda i: i.key)

        serialized = serialize(
            providers,
            organization=organization,
            serializer=IntegrationProviderSerializer(),
        )

        return Response({'providers': serialized})
    def get(self, request, organization):
        def is_provider_enabled(provider):
            if not provider.requires_feature_flag:
                return True
            feature_flag_name = "organizations:integrations-%s" % provider.key
            return features.has(feature_flag_name,
                                organization,
                                actor=request.user)

        providers = filter(is_provider_enabled, list(integrations.all()))

        providers.sort(key=lambda i: i.key)

        serialized = serialize(providers,
                               organization=organization,
                               serializer=IntegrationProviderSerializer())

        if "provider_key" in request.GET:
            serialized = [
                d for d in serialized
                if d["key"] == request.GET["provider_key"]
            ]

        if not serialized:
            return Response({"detail": "Providers do not exist"}, status=404)

        return Response({"providers": serialized})
    def get(self, request, organization):
        providers = list(integrations.all())
        providers.sort(key=lambda i: i.key)

        serialized = serialize(
            providers, organization=organization, serializer=IntegrationProviderSerializer()
        )

        return Response({"providers": serialized})
Ejemplo n.º 5
0
    def get(self, request, organization):
        has_bb = features.has('organizations:bitbucket-integration',
                              organization,
                              actor=request.user)
        has_ghe = features.has('organizations:github-enterprise',
                               organization,
                               actor=request.user)
        has_catchall = features.has('organizations:internal-catchall',
                                    organization,
                                    actor=request.user)
        has_github_apps = features.has('organizations:github-apps',
                                       organization,
                                       actor=request.user)
        has_jira = features.has('organizations:jira-integration',
                                organization,
                                actor=request.user)
        has_vsts = features.has('organizations:vsts-integration',
                                organization,
                                actor=request.user)

        providers = []
        for provider in integrations.all():
            internal_integrations = {
                i
                for i in settings.SENTRY_INTERNAL_INTEGRATIONS
            }
            if has_bb:
                internal_integrations.remove('bitbucket')
            if has_ghe:
                internal_integrations.remove('github_enterprise')
            if has_github_apps:
                internal_integrations.remove('github')
            if has_jira:
                internal_integrations.remove('jira')
            if has_vsts:
                internal_integrations.remove('vsts')
            if not has_catchall and provider.key in internal_integrations:
                continue

            providers.append(provider)

        providers.sort(key=lambda i: i.key)

        serialized = serialize(
            providers,
            organization=organization,
            serializer=IntegrationProviderSerializer(),
        )

        return Response({'providers': serialized})
    def get(self, request, organization):

        providers = list(integrations.all())

        providers.sort(key=lambda i: i.key)

        serialized = serialize(
            providers, organization=organization, serializer=IntegrationProviderSerializer()
        )

        if "provider_key" in request.GET:
            serialized = list(filter(lambda d: d["key"] == request.GET["provider_key"], serialized))

        if not serialized:
            return Response({"detail": "Providers do not exist"}, status=404)

        return Response({"providers": serialized})
    def get(self, request, organization):
        has_pagerduty = features.has("organizations:pagerduty-v2",
                                     organization,
                                     actor=request.user)

        providers = []
        for provider in integrations.all():
            if not has_pagerduty and provider.key == "pagerduty":
                continue

            providers.append(provider)

        providers.sort(key=lambda i: i.key)

        serialized = serialize(providers,
                               organization=organization,
                               serializer=IntegrationProviderSerializer())

        return Response({"providers": serialized})
    def get(self, request, organization):
        has_catchall = features.has("organizations:internal-catchall",
                                    organization,
                                    actor=request.user)

        providers = []
        for provider in integrations.all():
            if not has_catchall and provider.key in settings.SENTRY_INTERNAL_INTEGRATIONS:
                continue

            providers.append(provider)

        providers.sort(key=lambda i: i.key)

        serialized = serialize(providers,
                               organization=organization,
                               serializer=IntegrationProviderSerializer())

        return Response({"providers": serialized})
Ejemplo n.º 9
0
    def get(self, request, organization):
        has_jira_server = features.has('organizations:jira-server-integration',
                                       organization,
                                       actor=request.user)
        providers = []
        for provider in integrations.all():
            if not has_jira_server and provider.key == 'jira_server':
                continue
            providers.append(provider)

        providers.sort(key=lambda i: i.key)

        serialized = serialize(
            providers,
            organization=organization,
            serializer=IntegrationProviderSerializer(),
        )

        return Response({'providers': serialized})