Added missing migration file. Added permission to admin and staff group.

This commit is contained in:
Emanuel Schütze 2018-10-29 15:08:09 +01:00 committed by Norman Jäckel
parent af26dedfaf
commit 2abf8e27ca
3 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,28 @@
# Generated by Django 2.1.2 on 2018-10-29 13:54
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('motions', '0014_motionchangerecommendation_internal'),
]
operations = [
migrations.AlterModelOptions(
name='motion',
options={
'default_permissions': (),
'ordering': ('identifier',),
'permissions': (
('can_see', 'Can see motions'),
('can_create', 'Can create motions'),
('can_support', 'Can support motions'),
('can_manage_metadata', 'Can manage motion metadata'),
('can_manage', 'Can manage motions')
),
'verbose_name': 'Motion'
},
),
]

View File

@ -231,6 +231,9 @@ class MotionViewSet(ModelViewSet):
self.permission_denied(request) self.permission_denied(request)
# Check permission to send only some data. # Check permission to send only some data.
# Attention: Users with motions.can_manage permission can change all
# fields even if they do not have motions.can_manage_metadata
# permission.
if not has_perm(request.user, 'motions.can_manage'): if not has_perm(request.user, 'motions.can_manage'):
# Remove fields that the user is not allowed to change. # Remove fields that the user is not allowed to change.
# The list() is required because we want to use del inside the loop. # The list() is required because we want to use del inside the loop.

View File

@ -53,6 +53,7 @@ def create_builtin_groups_and_admin(**kwargs):
'mediafiles.can_upload', 'mediafiles.can_upload',
'motions.can_create', 'motions.can_create',
'motions.can_manage', 'motions.can_manage',
'motions.can_manage_metadata',
'motions.can_see', 'motions.can_see',
'motions.can_support', 'motions.can_support',
'users.can_manage', 'users.can_manage',
@ -126,6 +127,7 @@ def create_builtin_groups_and_admin(**kwargs):
permission_dict['motions.can_see'], permission_dict['motions.can_see'],
permission_dict['motions.can_create'], permission_dict['motions.can_create'],
permission_dict['motions.can_manage'], permission_dict['motions.can_manage'],
permission_dict['motions.can_manage_metadata'],
permission_dict['users.can_see_name'], permission_dict['users.can_see_name'],
permission_dict['users.can_manage'], permission_dict['users.can_manage'],
permission_dict['users.can_see_extra_data'], permission_dict['users.can_see_extra_data'],