From cbfc4da583f7c820fbdb9708a9d040f5764fab4d Mon Sep 17 00:00:00 2001
From: Ernesto Rico Schmidt <ernesto@helsinki.at>
Date: Tue, 8 Oct 2024 17:54:01 -0400
Subject: [PATCH] feat: introduce update_timeslot permission

---
 .../migrations/0117_alter_timeslot_options.py | 25 +++++++++++++++++++
 program/models.py                             |  2 ++
 2 files changed, 27 insertions(+)
 create mode 100644 program/migrations/0117_alter_timeslot_options.py

diff --git a/program/migrations/0117_alter_timeslot_options.py b/program/migrations/0117_alter_timeslot_options.py
new file mode 100644
index 00000000..728fc6ee
--- /dev/null
+++ b/program/migrations/0117_alter_timeslot_options.py
@@ -0,0 +1,25 @@
+# Generated by Django 4.2.16 on 2024-10-08 21:13
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ("program", "0116_alter_note_image_alter_notelink_type_and_more"),
+    ]
+
+    operations = [
+        migrations.AlterModelOptions(
+            name="timeslot",
+            options={
+                "ordering": ("start", "end"),
+                "permissions": [
+                    ("edit__timeslot__memo", "Can edit memo field"),
+                    ("edit__timeslot__playlist_id", "Can edit media-source"),
+                    ("edit__timeslot__repetition_of", "Can edit repetition of field"),
+                    ("update_timeslot", "Can update timeslot"),
+                ],
+            },
+        ),
+    ]
diff --git a/program/models.py b/program/models.py
index e8e32fcd..6984ea9a 100644
--- a/program/models.py
+++ b/program/models.py
@@ -464,6 +464,8 @@ class TimeSlot(models.Model):
             ("edit__timeslot__memo", "Can edit memo field"),
             ("edit__timeslot__playlist_id", "Can edit media-source"),
             ("edit__timeslot__repetition_of", "Can edit repetition of field"),
+            # overrides ownership
+            ("update_timeslot", "Can update timeslot"),
         ]
 
     def __str__(self):
-- 
GitLab