2018-08-15 11:15:54 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# Generated by Django 1.10.8 on 2018-08-15 09:09
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
from django.contrib.auth.models import Permission
|
|
|
|
from django.db import migrations, models
|
|
|
|
|
2018-07-09 23:22:26 +02:00
|
|
|
from openslides.utils.migrations import (
|
|
|
|
add_permission_to_groups_based_on_existing_permission,
|
|
|
|
)
|
2018-08-15 11:15:54 +02:00
|
|
|
|
|
|
|
|
|
|
|
def delete_old_can_see_hidden_permission(apps, schema_editor):
|
2019-01-06 16:22:33 +01:00
|
|
|
perm = Permission.objects.filter(codename="can_see_hidden_items")
|
2018-08-15 11:15:54 +02:00
|
|
|
if len(perm):
|
|
|
|
perm = perm.delete()
|
|
|
|
|
|
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
|
2019-01-06 16:22:33 +01:00
|
|
|
dependencies = [("agenda", "0004_speaker_marked")]
|
2018-08-15 11:15:54 +02:00
|
|
|
|
|
|
|
operations = [
|
|
|
|
migrations.AlterModelOptions(
|
2019-01-06 16:22:33 +01:00
|
|
|
name="item",
|
2018-08-15 11:15:54 +02:00
|
|
|
options={
|
2019-01-06 16:22:33 +01:00
|
|
|
"default_permissions": (),
|
|
|
|
"permissions": (
|
|
|
|
("can_see", "Can see agenda"),
|
|
|
|
("can_manage", "Can manage agenda"),
|
|
|
|
("can_manage_list_of_speakers", "Can manage list of speakers"),
|
|
|
|
(
|
|
|
|
"can_see_internal_items",
|
|
|
|
"Can see internal items and time scheduling of agenda",
|
|
|
|
),
|
|
|
|
),
|
2018-08-15 11:15:54 +02:00
|
|
|
},
|
|
|
|
),
|
|
|
|
migrations.AlterField(
|
2019-01-06 16:22:33 +01:00
|
|
|
model_name="item",
|
|
|
|
name="type",
|
2018-08-15 11:15:54 +02:00
|
|
|
field=models.IntegerField(
|
2019-01-06 16:22:33 +01:00
|
|
|
choices=[(1, "Agenda item"), (2, "Internal item"), (3, "Hidden item")],
|
|
|
|
default=3,
|
2018-08-15 11:15:54 +02:00
|
|
|
),
|
|
|
|
),
|
2019-01-06 16:22:33 +01:00
|
|
|
migrations.RunPython(
|
|
|
|
add_permission_to_groups_based_on_existing_permission(
|
|
|
|
"can_see_hidden_items",
|
|
|
|
"item",
|
|
|
|
"agenda",
|
|
|
|
"can_see_internal_items",
|
|
|
|
"Can see internal items and time scheduling of agenda",
|
|
|
|
)
|
|
|
|
),
|
2018-08-15 11:15:54 +02:00
|
|
|
migrations.RunPython(delete_old_can_see_hidden_permission),
|
|
|
|
]
|