Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Generated by Django 4.1.7 on 2023-03-27 15:16

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('dojo', '0183_system_settings_enable_notify_sla_exponential_backoff_and_more'),
]

operations = [
migrations.RemoveField(
model_name='child_rule',
name='parent_rule',
),
migrations.DeleteModel(
name='FieldRule',
),
migrations.RemoveField(
model_name='rule',
name='child_rules',
),
migrations.RemoveField(
model_name='rule',
name='parent_rule',
),
migrations.RemoveField(
model_name='system_settings',
name='column_widths',
),
migrations.RemoveField(
model_name='system_settings',
name='drive_folder_ID',
),
migrations.RemoveField(
model_name='system_settings',
name='email_address',
),
migrations.RemoveField(
model_name='system_settings',
name='enable_google_sheets',
),
migrations.RemoveField(
model_name='system_settings',
name='enable_rules_framework',
),
migrations.DeleteModel(
name='Child_Rule',
),
migrations.DeleteModel(
name='Rule',
),
]
4 changes: 0 additions & 4 deletions dojo/fixtures/defect_dojo_sample_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -7121,10 +7121,6 @@
"allow_anonymous_survey_repsonse": false,
"credentials": "",
"disclaimer": "",
"column_widths": "",
"drive_folder_ID": "",
"enable_google_sheets": false,
"email_address": "",
"risk_acceptance_form_default_days": 180,
"risk_acceptance_notify_before_expiration": 10,
"enable_credentials": true,
Expand Down
80 changes: 64 additions & 16 deletions dojo/fixtures/questionnaire_testdata.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,52 @@
[
{
"fields": {
"model": "question",
"app_label": "dojo"
},
"model": "contenttypes.contenttype",
"pk": 65
},
{
"fields": {
"model": "answer",
"app_label": "dojo"
},
"model": "contenttypes.contenttype",
"pk": 68
},
{
"fields": {
"model": "textquestion",
"app_label": "dojo"
},
"model": "contenttypes.contenttype",
"pk": 66
},
{
"fields": {
"model": "textanswer",
"app_label": "dojo"
},
"model": "contenttypes.contenttype",
"pk": 69
},
{
"fields": {
"model": "choicequestion",
"app_label": "dojo"
},
"model": "contenttypes.contenttype",
"pk": 71
},
{
"fields": {
"model": "choiceanswer",
"app_label": "dojo"
},
"model": "contenttypes.contenttype",
"pk": 70
},
{
"pk": 1,
"model": "auth.user",
Expand Down Expand Up @@ -163,7 +211,7 @@
"model": "dojo.question",
"pk": 14,
"fields": {
"polymorphic_ctype": 69,
"polymorphic_ctype": 66,
"created": "2015-03-30T19:57:22Z",
"modified": "2015-03-30T19:57:22Z",
"order": 1,
Expand All @@ -175,7 +223,7 @@
"model": "dojo.question",
"pk": 15,
"fields": {
"polymorphic_ctype": 69,
"polymorphic_ctype": 66,
"created": "2015-03-30T19:57:34Z",
"modified": "2015-03-30T19:57:34Z",
"order": 1,
Expand All @@ -187,7 +235,7 @@
"model": "dojo.question",
"pk": 16,
"fields": {
"polymorphic_ctype": 69,
"polymorphic_ctype": 66,
"created": "2015-03-30T19:57:55Z",
"modified": "2015-03-30T19:57:55Z",
"order": 1,
Expand All @@ -199,7 +247,7 @@
"model": "dojo.question",
"pk": 17,
"fields": {
"polymorphic_ctype": 69,
"polymorphic_ctype": 66,
"created": "2015-03-30T19:58:36Z",
"modified": "2015-03-30T19:58:36Z",
"order": 1,
Expand All @@ -211,7 +259,7 @@
"model": "dojo.question",
"pk": 18,
"fields": {
"polymorphic_ctype": 69,
"polymorphic_ctype": 66,
"created": "2015-03-30T20:00:35Z",
"modified": "2015-03-30T20:00:35Z",
"order": 1,
Expand All @@ -223,7 +271,7 @@
"model": "dojo.question",
"pk": 19,
"fields": {
"polymorphic_ctype": 69,
"polymorphic_ctype": 66,
"created": "2015-03-30T20:00:46Z",
"modified": "2015-03-30T20:00:46Z",
"order": 1,
Expand All @@ -235,7 +283,7 @@
"model": "dojo.question",
"pk": 20,
"fields": {
"polymorphic_ctype": 69,
"polymorphic_ctype": 66,
"created": "2015-03-30T20:00:58Z",
"modified": "2015-03-30T20:00:58Z",
"order": 1,
Expand All @@ -247,7 +295,7 @@
"model": "dojo.question",
"pk": 44,
"fields": {
"polymorphic_ctype": 74,
"polymorphic_ctype": 71,
"created": "2023-03-02T17:58:59.698Z",
"modified": "2023-03-02T17:58:59.737Z",
"order": 1,
Expand Down Expand Up @@ -410,7 +458,7 @@
"model": "dojo.answer",
"pk": 1,
"fields": {
"polymorphic_ctype": 73,
"polymorphic_ctype": 70,
"created": "2023-03-02T19:07:55.430Z",
"modified": "2023-03-02T19:07:55.447Z",
"question": 44,
Expand All @@ -421,7 +469,7 @@
"model": "dojo.answer",
"pk": 2,
"fields": {
"polymorphic_ctype": 72,
"polymorphic_ctype": 69,
"created": "2023-03-02T19:14:07.816Z",
"modified": "2023-03-02T19:14:07.822Z",
"question": 14,
Expand All @@ -432,7 +480,7 @@
"model": "dojo.answer",
"pk": 3,
"fields": {
"polymorphic_ctype": 72,
"polymorphic_ctype": 69,
"created": "2023-03-02T19:14:07.829Z",
"modified": "2023-03-02T19:14:07.833Z",
"question": 15,
Expand All @@ -443,7 +491,7 @@
"model": "dojo.answer",
"pk": 4,
"fields": {
"polymorphic_ctype": 72,
"polymorphic_ctype": 69,
"created": "2023-03-02T19:14:07.838Z",
"modified": "2023-03-02T19:14:07.841Z",
"question": 16,
Expand All @@ -454,7 +502,7 @@
"model": "dojo.answer",
"pk": 5,
"fields": {
"polymorphic_ctype": 72,
"polymorphic_ctype": 69,
"created": "2023-03-02T19:14:07.845Z",
"modified": "2023-03-02T19:14:07.848Z",
"question": 17,
Expand All @@ -465,7 +513,7 @@
"model": "dojo.answer",
"pk": 6,
"fields": {
"polymorphic_ctype": 72,
"polymorphic_ctype": 69,
"created": "2023-03-02T19:14:07.853Z",
"modified": "2023-03-02T19:14:07.856Z",
"question": 19,
Expand All @@ -476,7 +524,7 @@
"model": "dojo.answer",
"pk": 7,
"fields": {
"polymorphic_ctype": 72,
"polymorphic_ctype": 69,
"created": "2023-03-02T19:14:07.861Z",
"modified": "2023-03-02T19:14:07.864Z",
"question": 20,
Expand All @@ -487,7 +535,7 @@
"model": "dojo.answer",
"pk": 8,
"fields": {
"polymorphic_ctype": 72,
"polymorphic_ctype": 69,
"created": "2023-03-02T19:14:07.868Z",
"modified": "2023-03-02T19:14:07.871Z",
"question": 18,
Expand Down
67 changes: 2 additions & 65 deletions dojo/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
JIRA_Issue, JIRA_Project, JIRA_Instance, GITHUB_Issue, GITHUB_PKey, GITHUB_Conf, UserContactInfo, Tool_Type, \
Tool_Configuration, Tool_Product_Settings, Cred_User, Cred_Mapping, System_Settings, Notifications, \
App_Analysis, Objects_Product, Benchmark_Product, Benchmark_Requirement, \
Benchmark_Product_Summary, Rule, Child_Rule, Engagement_Presets, DojoMeta, \
Benchmark_Product_Summary, Engagement_Presets, DojoMeta, \
Engagement_Survey, Answered_Survey, TextAnswer, ChoiceAnswer, Choice, Question, TextQuestion, \
ChoiceQuestion, General_Survey, Regulation, FileUpload, SEVERITY_CHOICES, Product_Type_Member, \
Product_Member, Global_Role, Dojo_Group, Product_Group, Product_Type_Group, Dojo_Group_Member, \
Expand Down Expand Up @@ -2493,7 +2493,7 @@ def __init__(self, *args, **kwargs):

class Meta:
model = System_Settings
exclude = ['product_grade', 'credentials', 'column_widths', 'drive_folder_ID']
exclude = ['product_grade']


class BenchmarkForm(forms.ModelForm):
Expand Down Expand Up @@ -2539,32 +2539,6 @@ def valid_value(self, value):
return True


class RuleForm(forms.ModelForm):

class Meta:
model = Rule
exclude = ['key_product']


class ChildRuleForm(forms.ModelForm):

class Meta:
model = Child_Rule
exclude = ['key_product']


RuleFormSet = modelformset_factory(Child_Rule, extra=2, max_num=10, exclude=[''], can_delete=True)


class DeleteRuleForm(forms.ModelForm):
id = forms.IntegerField(required=True,
widget=forms.widgets.HiddenInput())

class Meta:
model = Rule
fields = ['id']


class CredUserForm(forms.ModelForm):
# selenium_script = forms.FileField(widget=forms.widgets.FileInput(
# attrs={"accept": ".py"}),
Expand Down Expand Up @@ -2874,43 +2848,6 @@ def __init__(self, *args, **kwargs):
epic_priority = forms.CharField(max_length=200, required=False, help_text="EPIC priority. If not specified, the JIRA default priority will be used")


class GoogleSheetFieldsForm(forms.Form):
cred_file = forms.FileField(widget=forms.widgets.FileInput(
attrs={"accept": ".json"}),
label="Google credentials file",
required=True,
allow_empty_file=False,
help_text="Upload the credentials file downloaded from the Google Developer Console")
drive_folder_ID = forms.CharField(
required=True,
label="Google Drive folder ID",
help_text="Extract the Drive folder ID from the URL and provide it here")
email_address = forms.EmailField(
required=True,
label="Email Address",
help_text="Enter the same email Address used to create the Service Account")
enable_service = forms.BooleanField(
initial=False,
required=False,
help_text='Tick this check box to enable Google Sheets Sync feature')

def __init__(self, *args, **kwargs):
self.credentials_required = kwargs.pop('credentials_required')
options = ((0, 'Hide'), (100, 'Small'), (200, 'Medium'), (400, 'Large'))
protect = ['reporter', 'url', 'numerical_severity', 'endpoint', 'under_review', 'reviewers',
'review_requested_by', 'is_mitigated', 'jira_creation', 'jira_change', 'sonarqube_issue']
self.all_fields = kwargs.pop('all_fields')
super(GoogleSheetFieldsForm, self).__init__(*args, **kwargs)
if not self.credentials_required:
self.fields['cred_file'].required = False
for i in self.all_fields:
self.fields[i.name] = forms.ChoiceField(choices=options)
if i.name == 'id' or i.editable is False or i.many_to_one or i.name in protect:
self.fields['Protect ' + i.name] = forms.BooleanField(initial=True, required=True, disabled=True)
else:
self.fields['Protect ' + i.name] = forms.BooleanField(initial=False, required=False)


class LoginBanner(forms.Form):
banner_enable = forms.BooleanField(
label="Enable login banner",
Expand Down
Empty file removed dojo/google_sheet/__init__.py
Empty file.
11 changes: 0 additions & 11 deletions dojo/google_sheet/urls.py

This file was deleted.

Loading