-
Notifications
You must be signed in to change notification settings - Fork 288
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cap asset security objective max value to 3 (#1344)
* Cap asset security objective max value to 3 For now, we only manage 4-value security objective scales. * Missing migration --------- Co-authored-by: Abderrahmane Smimite <smimite@gmail.com>
- Loading branch information
1 parent
e2cb70b
commit 810b92a
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
backend/core/migrations/0048_alter_asset_security_objectives.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Generated by Django 5.1.4 on 2025-01-11 11:53 | ||
|
||
import core.validators | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("core", "0047_loadedlibrary_publication_date_and_more"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="asset", | ||
name="security_objectives", | ||
field=models.JSONField( | ||
blank=True, | ||
default=dict, | ||
help_text="The security objectives of the asset", | ||
validators=[ | ||
core.validators.JSONSchemaInstanceValidator( | ||
{ | ||
"$id": "https://ciso-assistant.com/schemas/assets/security_objectives.schema.json", | ||
"$schema": "https://json-schema.org/draft/2020-12/schema", | ||
"description": "The security objectives of the asset", | ||
"properties": { | ||
"objectives": { | ||
"patternProperties": { | ||
"^[a-z_]+$": { | ||
"properties": { | ||
"is_enabled": {"type": "boolean"}, | ||
"value": { | ||
"maximum": 3, | ||
"minimum": 0, | ||
"type": "integer", | ||
}, | ||
}, | ||
"type": "object", | ||
} | ||
}, | ||
"type": "object", | ||
} | ||
}, | ||
"title": "Security objectives", | ||
"type": "object", | ||
} | ||
) | ||
], | ||
verbose_name="Security objectives", | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters