diff --git a/authentik/policies/migrations/0009_alter_policy_name.py b/authentik/policies/migrations/0009_alter_policy_name.py new file mode 100644 index 000000000..732e9f0ba --- /dev/null +++ b/authentik/policies/migrations/0009_alter_policy_name.py @@ -0,0 +1,19 @@ +# Generated by Django 4.1.4 on 2022-12-25 13:46 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("authentik_policies", "0008_policybinding_authentik_p_policy__534e15_idx_and_more"), + ] + + operations = [ + migrations.AlterField( + model_name="policy", + name="name", + field=models.TextField(default="unnamed-policy"), + preserve_default=False, + ), + ] diff --git a/authentik/policies/models.py b/authentik/policies/models.py index c1bab3297..a6cf73c91 100644 --- a/authentik/policies/models.py +++ b/authentik/policies/models.py @@ -159,7 +159,7 @@ class Policy(SerializerModel, CreatedUpdatedModel): policy_uuid = models.UUIDField(primary_key=True, editable=False, default=uuid4) - name = models.TextField(blank=True, null=True) + name = models.TextField() execution_logging = models.BooleanField( default=False, diff --git a/schema.yml b/schema.yml index 392fd4808..b95548960 100644 --- a/schema.yml +++ b/schema.yml @@ -10249,6 +10249,7 @@ paths: application/json: schema: $ref: '#/components/schemas/DummyPolicyRequest' + required: true security: - authentik: [] responses: @@ -10323,6 +10324,7 @@ paths: application/json: schema: $ref: '#/components/schemas/DummyPolicyRequest' + required: true security: - authentik: [] responses: @@ -10626,6 +10628,7 @@ paths: application/json: schema: $ref: '#/components/schemas/EventMatcherPolicyRequest' + required: true security: - authentik: [] responses: @@ -10700,6 +10703,7 @@ paths: application/json: schema: $ref: '#/components/schemas/EventMatcherPolicyRequest' + required: true security: - authentik: [] responses: @@ -11212,6 +11216,7 @@ paths: application/json: schema: $ref: '#/components/schemas/HaveIBeenPwendPolicyRequest' + required: true security: - authentik: [] responses: @@ -11286,6 +11291,7 @@ paths: application/json: schema: $ref: '#/components/schemas/HaveIBeenPwendPolicyRequest' + required: true security: - authentik: [] responses: @@ -11550,6 +11556,7 @@ paths: application/json: schema: $ref: '#/components/schemas/PasswordPolicyRequest' + required: true security: - authentik: [] responses: @@ -11624,6 +11631,7 @@ paths: application/json: schema: $ref: '#/components/schemas/PasswordPolicyRequest' + required: true security: - authentik: [] responses: @@ -12144,6 +12152,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ReputationPolicyRequest' + required: true security: - authentik: [] responses: @@ -12218,6 +12227,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ReputationPolicyRequest' + required: true security: - authentik: [] responses: @@ -26978,7 +26988,6 @@ components: title: Policy uuid name: type: string - nullable: true execution_logging: type: boolean description: When this option is enabled, all executions of this policy @@ -27012,6 +27021,7 @@ components: - bound_to - component - meta_model_name + - name - pk - verbose_name - verbose_name_plural @@ -27021,7 +27031,7 @@ components: properties: name: type: string - nullable: true + minLength: 1 execution_logging: type: boolean description: When this option is enabled, all executions of this policy @@ -27036,6 +27046,8 @@ components: type: integer maximum: 2147483647 minimum: -2147483648 + required: + - name DummyStage: type: object description: DummyStage Serializer @@ -27392,7 +27404,6 @@ components: title: Policy uuid name: type: string - nullable: true execution_logging: type: boolean description: When this option is enabled, all executions of this policy @@ -27430,6 +27441,7 @@ components: - bound_to - component - meta_model_name + - name - pk - verbose_name - verbose_name_plural @@ -27439,7 +27451,7 @@ components: properties: name: type: string - nullable: true + minLength: 1 execution_logging: type: boolean description: When this option is enabled, all executions of this policy @@ -27458,6 +27470,8 @@ components: - $ref: '#/components/schemas/AppEnum' description: Match events created by selected application. When left empty, all applications are matched. + required: + - name EventRequest: type: object description: Event Serializer @@ -27540,7 +27554,6 @@ components: title: Policy uuid name: type: string - nullable: true execution_logging: type: boolean description: When this option is enabled, all executions of this policy @@ -27567,6 +27580,7 @@ components: - component - expression - meta_model_name + - name - pk - verbose_name - verbose_name_plural @@ -27576,7 +27590,7 @@ components: properties: name: type: string - nullable: true + minLength: 1 execution_logging: type: boolean description: When this option is enabled, all executions of this policy @@ -27586,6 +27600,7 @@ components: minLength: 1 required: - expression + - name FilePathRequest: type: object description: Serializer to upload file @@ -28240,7 +28255,6 @@ components: title: Policy uuid name: type: string - nullable: true execution_logging: type: boolean description: When this option is enabled, all executions of this policy @@ -28272,6 +28286,7 @@ components: - bound_to - component - meta_model_name + - name - pk - verbose_name - verbose_name_plural @@ -28281,7 +28296,7 @@ components: properties: name: type: string - nullable: true + minLength: 1 execution_logging: type: boolean description: When this option is enabled, all executions of this policy @@ -28295,6 +28310,8 @@ components: type: integer maximum: 2147483647 minimum: -2147483648 + required: + - name IdentificationChallenge: type: object description: Identification challenges with all UI elements @@ -32967,7 +32984,6 @@ components: title: Policy uuid name: type: string - nullable: true execution_logging: type: boolean description: When this option is enabled, all executions of this policy @@ -32998,6 +33014,7 @@ components: - component - days - meta_model_name + - name - pk - verbose_name - verbose_name_plural @@ -33007,7 +33024,7 @@ components: properties: name: type: string - nullable: true + minLength: 1 execution_logging: type: boolean description: When this option is enabled, all executions of this policy @@ -33020,6 +33037,7 @@ components: type: boolean required: - days + - name PasswordPolicy: type: object description: Password Policy Serializer @@ -33031,7 +33049,6 @@ components: title: Policy uuid name: type: string - nullable: true execution_logging: type: boolean description: When this option is enabled, all executions of this policy @@ -33100,6 +33117,7 @@ components: - bound_to - component - meta_model_name + - name - pk - verbose_name - verbose_name_plural @@ -33109,7 +33127,7 @@ components: properties: name: type: string - nullable: true + minLength: 1 execution_logging: type: boolean description: When this option is enabled, all executions of this policy @@ -33161,6 +33179,8 @@ components: minimum: 0 description: If the zxcvbn score is equal or less than this value, the policy will fail. + required: + - name PasswordStage: type: object description: PasswordStage Serializer @@ -33583,7 +33603,7 @@ components: properties: name: type: string - nullable: true + minLength: 1 execution_logging: type: boolean description: When this option is enabled, all executions of this policy @@ -33678,7 +33698,7 @@ components: properties: name: type: string - nullable: true + minLength: 1 execution_logging: type: boolean description: When this option is enabled, all executions of this policy @@ -33728,7 +33748,7 @@ components: properties: name: type: string - nullable: true + minLength: 1 execution_logging: type: boolean description: When this option is enabled, all executions of this policy @@ -33834,7 +33854,7 @@ components: properties: name: type: string - nullable: true + minLength: 1 execution_logging: type: boolean description: When this option is enabled, all executions of this policy @@ -34388,7 +34408,7 @@ components: properties: name: type: string - nullable: true + minLength: 1 execution_logging: type: boolean description: When this option is enabled, all executions of this policy @@ -34405,7 +34425,7 @@ components: properties: name: type: string - nullable: true + minLength: 1 execution_logging: type: boolean description: When this option is enabled, all executions of this policy @@ -34698,7 +34718,7 @@ components: properties: name: type: string - nullable: true + minLength: 1 execution_logging: type: boolean description: When this option is enabled, all executions of this policy @@ -35413,7 +35433,6 @@ components: title: Policy uuid name: type: string - nullable: true execution_logging: type: boolean description: When this option is enabled, all executions of this policy @@ -35437,6 +35456,7 @@ components: - bound_to - component - meta_model_name + - name - pk - verbose_name - verbose_name_plural @@ -35542,11 +35562,13 @@ components: properties: name: type: string - nullable: true + minLength: 1 execution_logging: type: boolean description: When this option is enabled, all executions of this policy will be logged. By default, only execution errors are logged. + required: + - name PolicyTestRequest: type: object description: Test policy execution for a user with context @@ -36280,7 +36302,6 @@ components: title: Policy uuid name: type: string - nullable: true execution_logging: type: boolean description: When this option is enabled, all executions of this policy @@ -36312,6 +36333,7 @@ components: - bound_to - component - meta_model_name + - name - pk - verbose_name - verbose_name_plural @@ -36321,7 +36343,7 @@ components: properties: name: type: string - nullable: true + minLength: 1 execution_logging: type: boolean description: When this option is enabled, all executions of this policy @@ -36334,6 +36356,8 @@ components: type: integer maximum: 2147483647 minimum: -2147483648 + required: + - name ResidentKeyRequirementEnum: enum: - discouraged