Skip to content
Snippets Groups Projects
Commit cbc7a236 authored by Radovan Krebs's avatar Radovan Krebs
Browse files

Fix errors found during release

Fixed setting of IsAuthenticated permissions class.

Added send_emails field to pool serializer update method.

Change condition for choosing email protocol.

Allow deleting request groups with the pool.
parent e136edc9
No related branches found
No related tags found
No related merge requests found
......@@ -21,7 +21,7 @@ def send_email(receiver_email, subject, body, kypo_config: KypoConfiguration):
em['Subject'] = subject
em.set_content(body)
if kypo_config.sender_email_password is None:
if not kypo_config.sender_email_password:
send_insecure_email(receiver_email, em, kypo_config)
else:
send_secure_email(receiver_email, em, kypo_config)
......
# Generated by Django 5.0.6 on 2024-06-07 10:49
import django.db.models.deletion
import kypo.sandbox_instance_app.lib.email_notifications
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sandbox_instance_app', '0010_pool_send_emails_sandboxrequestgroup'),
]
operations = [
migrations.AlterField(
model_name='pool',
name='send_emails',
field=models.BooleanField(default=False, validators=[kypo.sandbox_instance_app.lib.email_notifications.validate_emails_enabled]),
),
migrations.AlterField(
model_name='sandboxrequestgroup',
name='pool',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='sandbox_instance_app.pool'),
),
]
......@@ -356,7 +356,7 @@ class SandboxRequestGroup(models.Model):
Keeps track of the request progress and sends email notifications.
"""
pool = models.ForeignKey(Pool, on_delete=models.PROTECT)
pool = models.ForeignKey(Pool, on_delete=models.CASCADE)
unit_count = models.IntegerField()
email = models.EmailField()
failed_count = models.IntegerField(default=0)
......
......@@ -40,6 +40,7 @@ class PoolSerializer(serializers.ModelSerializer):
instance.max_size = validated_data.get('max_size', instance.max_size)
instance.comment = validated_data.get('comment', instance.comment)
instance.visible = validated_data.get('visible', instance.visible)
instance.send_emails = validated_data.get('send_emails', instance.send_emails)
instance.save()
return instance
......
......@@ -180,7 +180,7 @@ if KYPO_SERVICE_CONFIG.authentication.authenticated_rest_api:
REST_FRAMEWORK.update({
'DEFAULT_PERMISSION_CLASSES': (
'kypo.sandbox_common_lib.permissions.ModelPermissions',
'kypo.sandbox_common_lib.permissions.IsAuthenticated',
'rest_framework.permissions.IsAuthenticated',
),
'DEFAULT_AUTHENTICATION_CLASSES': (
# For testing purposes, uncomment BasicAuthentication.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment