def handle(self, request, organization):
        form = self.get_form(request, organization)
        if form.is_valid():
            organization = form.save(commit=False)
            organization.flags.allow_joinleave = form.cleaned_data['allow_joinleave']
            organization.flags.enhanced_privacy = form.cleaned_data['enhanced_privacy']
            organization.flags.disable_shared_issues = not form.cleaned_data['allow_shared_issues']
            organization.flags.early_adopter = form.cleaned_data['early_adopter']
            organization.save()

            data_scrubbing_options = (
                'require_scrub_data', 'require_scrub_defaults', 'sensitive_fields', 'safe_fields',
                'require_scrub_ip_address'
            )

            for opt in data_scrubbing_options:
                value = form.cleaned_data.get(opt)
                if value is None:
                    organization.delete_option('sentry:%s' % (opt, ))
                else:
                    organization.update_option('sentry:%s' % (opt, ), value)

            self.create_audit_entry(
                request,
                organization=organization,
                target_object=organization.id,
                event=AuditLogEntryEvent.ORG_EDIT,
                data=organization.get_audit_log_data(),
            )

            messages.add_message(
                request, messages.SUCCESS, _('Changes to your organization were saved.')
            )

            if any(
                (
                    scrubbing_field in form.cleaned_data
                    for scrubbing_field in data_scrubbing_options
                )
            ):
                data_scrubber_enabled.send(organization=organization, sender=request.user)

            return HttpResponseRedirect(
                reverse('sentry-organization-settings', args=[organization.slug])
            )

        context = {
            'form': form,
        }

        return self.respond('sentry/organization-settings.html', context)
示例#2
0
    def handle(self, request, organization):
        form = self.get_form(request, organization)
        if form.is_valid():
            organization = form.save(commit=False)
            organization.flags.allow_joinleave = form.cleaned_data[
                'allow_joinleave']
            organization.flags.enhanced_privacy = form.cleaned_data[
                'enhanced_privacy']
            organization.flags.disable_shared_issues = not form.cleaned_data[
                'allow_shared_issues']
            organization.flags.early_adopter = form.cleaned_data[
                'early_adopter']
            organization.save()

            data_scrubbing_options = ('require_scrub_data',
                                      'require_scrub_defaults',
                                      'sensitive_fields', 'safe_fields',
                                      'require_scrub_ip_address')

            for opt in data_scrubbing_options:
                value = form.cleaned_data.get(opt)
                if value is None:
                    organization.delete_option('sentry:%s' % (opt, ))
                else:
                    organization.update_option('sentry:%s' % (opt, ), value)

            self.create_audit_entry(
                request,
                organization=organization,
                target_object=organization.id,
                event=AuditLogEntryEvent.ORG_EDIT,
                data=organization.get_audit_log_data(),
            )

            messages.add_message(request, messages.SUCCESS,
                                 _('Changes to your organization were saved.'))

            if any((scrubbing_field in form.cleaned_data
                    for scrubbing_field in data_scrubbing_options)):
                data_scrubber_enabled.send(organization=organization,
                                           sender=request.user)

            return HttpResponseRedirect(
                reverse('sentry-organization-settings',
                        args=[organization.slug]))

        context = {
            'form': form,
        }

        return self.respond('sentry/organization-settings.html', context)
示例#3
0
 def test_data_scrubber(self):
     data_scrubber_enabled.send(organization=self.organization,
                                sender=type(self.organization))
     feature_complete = FeatureAdoption.objects.get_by_slug(
         organization=self.organization, slug="data_scrubbers")
     assert feature_complete
示例#4
0
 def test_data_scrubber(self):
     data_scrubber_enabled.send(organization=self.organization, sender=type(self.organization))
     feature_complete = FeatureAdoption.objects.get_by_slug(
         organization=self.organization, slug="data_scrubbers"
     )
     assert feature_complete