From 114a38e4ee1189e9dd9f25a27cfd9151161b2e5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Thu, 10 Dec 2015 00:20:59 +0100 Subject: [PATCH] Deleted Django's default permissions. --- .../migrations/0005_auto_20151210_0016.py | 27 +++++++++ openslides/agenda/models.py | 2 + .../migrations/0003_auto_20151210_0016.py | 42 ++++++++++++++ openslides/assignments/models.py | 11 ++++ .../migrations/0008_auto_20151210_0016.py | 39 +++++++++++++ openslides/core/models.py | 10 +++- .../migrations/0004_auto_20151210_0016.py | 24 ++++++++ openslides/mediafiles/models.py | 1 + .../migrations/0005_auto_20151210_0019.py | 58 +++++++++++++++++++ openslides/motions/models.py | 25 +++++++- .../migrations/0004_auto_20151210_0016.py | 24 ++++++++ openslides/users/models.py | 1 + 12 files changed, 259 insertions(+), 5 deletions(-) create mode 100644 openslides/agenda/migrations/0005_auto_20151210_0016.py create mode 100644 openslides/assignments/migrations/0003_auto_20151210_0016.py create mode 100644 openslides/core/migrations/0008_auto_20151210_0016.py create mode 100644 openslides/mediafiles/migrations/0004_auto_20151210_0016.py create mode 100644 openslides/motions/migrations/0005_auto_20151210_0019.py create mode 100644 openslides/users/migrations/0004_auto_20151210_0016.py diff --git a/openslides/agenda/migrations/0005_auto_20151210_0016.py b/openslides/agenda/migrations/0005_auto_20151210_0016.py new file mode 100644 index 000000000..222db5953 --- /dev/null +++ b/openslides/agenda/migrations/0005_auto_20151210_0016.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('agenda', '0004_auto_20151027_1423'), + ] + + operations = [ + migrations.AlterModelOptions( + name='item', + options={ + 'permissions': ( + ('can_see', 'Can see agenda'), + ('can_manage', 'Can manage agenda'), + ('can_see_hidden_items', 'Can see hidden items and time scheduling of agenda')), + 'default_permissions': ()}, + ), + migrations.AlterModelOptions( + name='speaker', + options={'permissions': (('can_be_speaker', 'Can put oneself on the list of speakers'),), 'default_permissions': ()}, + ), + ] diff --git a/openslides/agenda/models.py b/openslides/agenda/models.py index 9ef997b45..047e9cfb4 100644 --- a/openslides/agenda/models.py +++ b/openslides/agenda/models.py @@ -222,6 +222,7 @@ class Item(RESTModelMixin, models.Model): """ class Meta: + default_permissions = () permissions = ( ('can_see', ugettext_noop("Can see agenda")), ('can_manage', ugettext_noop("Can manage agenda")), @@ -343,6 +344,7 @@ class Speaker(RESTModelMixin, models.Model): """ class Meta: + default_permissions = () permissions = ( ('can_be_speaker', ugettext_noop('Can put oneself on the list of speakers')), ) diff --git a/openslides/assignments/migrations/0003_auto_20151210_0016.py b/openslides/assignments/migrations/0003_auto_20151210_0016.py new file mode 100644 index 000000000..2810beebc --- /dev/null +++ b/openslides/assignments/migrations/0003_auto_20151210_0016.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('assignments', '0002_auto_20151126_2153'), + ] + + operations = [ + migrations.AlterModelOptions( + name='assignment', + options={ + 'permissions': ( + ('can_see', 'Can see elections'), + ('can_nominate_other', 'Can nominate another participant'), + ('can_nominate_self', 'Can nominate oneself'), + ('can_manage', 'Can manage elections')), + 'ordering': ('title',), + 'default_permissions': (), + 'verbose_name': 'Election'}, + ), + migrations.AlterModelOptions( + name='assignmentoption', + options={'default_permissions': ()}, + ), + migrations.AlterModelOptions( + name='assignmentpoll', + options={'default_permissions': ()}, + ), + migrations.AlterModelOptions( + name='assignmentrelateduser', + options={'default_permissions': ()}, + ), + migrations.AlterModelOptions( + name='assignmentvote', + options={'default_permissions': ()}, + ), + ] diff --git a/openslides/assignments/models.py b/openslides/assignments/models.py index 37927bf40..30633bec6 100644 --- a/openslides/assignments/models.py +++ b/openslides/assignments/models.py @@ -41,6 +41,7 @@ class AssignmentRelatedUser(RESTModelMixin, models.Model): default=STATUS_CANDIDATE) class Meta: + default_permissions = () unique_together = ('assignment', 'user') def __str__(self): @@ -116,6 +117,7 @@ class Assignment(RESTModelMixin, models.Model): """ class Meta: + default_permissions = () permissions = ( ('can_see', ugettext_noop('Can see elections')), ('can_nominate_other', ugettext_noop('Can nominate another participant')), @@ -320,6 +322,9 @@ class Assignment(RESTModelMixin, models.Model): class AssignmentVote(RESTModelMixin, BaseVote): option = models.ForeignKey('AssignmentOption', related_name='votes') + class Meta: + default_permissions = () + def get_root_rest_element(self): """ Returns the assignment to this instance which is the root REST element. @@ -332,6 +337,9 @@ class AssignmentOption(RESTModelMixin, BaseOption): candidate = models.ForeignKey(settings.AUTH_USER_MODEL) vote_class = AssignmentVote + class Meta: + default_permissions = () + def __str__(self): return str(self.candidate) @@ -354,6 +362,9 @@ class AssignmentPoll(RESTModelMixin, CollectDefaultVotesMixin, blank=True, verbose_name=ugettext_lazy("Comment on the ballot paper")) + class Meta: + default_permissions = () + def get_assignment(self): return self.assignment diff --git a/openslides/core/migrations/0008_auto_20151210_0016.py b/openslides/core/migrations/0008_auto_20151210_0016.py new file mode 100644 index 000000000..294bf6014 --- /dev/null +++ b/openslides/core/migrations/0008_auto_20151210_0016.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0007_clear_default_countdown'), + ] + + operations = [ + migrations.AlterModelOptions( + name='chatmessage', + options={'permissions': (('can_use_chat', 'Can use the chat'),), 'default_permissions': ()}, + ), + migrations.AlterModelOptions( + name='configstore', + options={'permissions': (('can_manage_config', 'Can manage configuration'),), 'default_permissions': ()}, + ), + migrations.AlterModelOptions( + name='customslide', + options={'ordering': ('weight', 'title'), 'default_permissions': ()}, + ), + migrations.AlterModelOptions( + name='projector', + options={ + 'permissions': ( + ('can_see_projector', 'Can see the projector'), + ('can_manage_projector', 'Can manage the projector'), + ('can_see_dashboard', 'Can see the dashboard')), + 'default_permissions': ()}, + ), + migrations.AlterModelOptions( + name='tag', + options={'permissions': (('can_manage_tags', 'Can manage tags'),), 'ordering': ('name',), 'default_permissions': ()}, + ), + ] diff --git a/openslides/core/models.py b/openslides/core/models.py index 9f909cb7b..6d8233a5e 100644 --- a/openslides/core/models.py +++ b/openslides/core/models.py @@ -61,6 +61,7 @@ class Projector(RESTModelMixin, models.Model): """ Contains general permissions that can not be placed in a specific app. """ + default_permissions = () permissions = ( ('can_see_projector', ugettext_noop('Can see the projector')), ('can_manage_projector', ugettext_noop('Can manage the projector')), @@ -131,6 +132,7 @@ class CustomSlide(RESTModelMixin, models.Model): default=0) class Meta: + default_permissions = () ordering = ('weight', 'title', ) def __str__(self): @@ -169,8 +171,9 @@ class Tag(RESTModelMixin, models.Model): class Meta: ordering = ('name',) + default_permissions = () permissions = ( - ('can_manage_tags', ugettext_noop('Can manage tags')), ) + ('can_manage_tags', ugettext_noop('Can manage tags')),) def __str__(self): return self.name @@ -188,7 +191,9 @@ class ConfigStore(models.Model): """The value of the config variable. """ class Meta: - permissions = (('can_manage_config', ugettext_noop('Can manage configuration')),) + default_permissions = () + permissions = ( + ('can_manage_config', ugettext_noop('Can manage configuration')),) class ChatMessage(RESTModelMixin, models.Model): @@ -207,6 +212,7 @@ class ChatMessage(RESTModelMixin, models.Model): verbose_name=ugettext_lazy('User')) class Meta: + default_permissions = () permissions = ( ('can_use_chat', ugettext_noop('Can use the chat')),) diff --git a/openslides/mediafiles/migrations/0004_auto_20151210_0016.py b/openslides/mediafiles/migrations/0004_auto_20151210_0016.py new file mode 100644 index 000000000..02531f74c --- /dev/null +++ b/openslides/mediafiles/migrations/0004_auto_20151210_0016.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('mediafiles', '0003_auto_20150917_1226'), + ] + + operations = [ + migrations.AlterModelOptions( + name='mediafile', + options={ + 'permissions': ( + ('can_see', 'Can see the list of files'), + ('can_upload', 'Can upload files'), + ('can_manage', 'Can manage files')), + 'ordering': ['title'], + 'default_permissions': ()}, + ), + ] diff --git a/openslides/mediafiles/models.py b/openslides/mediafiles/models.py index 04153c970..03ba53feb 100644 --- a/openslides/mediafiles/models.py +++ b/openslides/mediafiles/models.py @@ -30,6 +30,7 @@ class Mediafile(RESTModelMixin, models.Model): Meta class for the mediafile model. """ ordering = ['title'] + default_permissions = () permissions = ( ('can_see', ugettext_noop('Can see the list of files')), ('can_upload', ugettext_noop('Can upload files')), diff --git a/openslides/motions/migrations/0005_auto_20151210_0019.py b/openslides/motions/migrations/0005_auto_20151210_0019.py new file mode 100644 index 000000000..440accadd --- /dev/null +++ b/openslides/motions/migrations/0005_auto_20151210_0019.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('motions', '0004_auto_20151105_2312'), + ] + + operations = [ + migrations.AlterModelOptions( + name='category', + options={'ordering': ['prefix'], 'default_permissions': ()}, + ), + migrations.AlterModelOptions( + name='motion', + options={ + 'ordering': ('identifier',), + 'verbose_name': 'Motion', + 'default_permissions': (), + 'permissions': ( + ('can_see', 'Can see motions'), + ('can_create', 'Can create motions'), + ('can_support', 'Can support motions'), + ('can_manage', 'Can manage motions'))}, + ), + migrations.AlterModelOptions( + name='motionlog', + options={'ordering': ['-time'], 'default_permissions': ()}, + ), + migrations.AlterModelOptions( + name='motionoption', + options={'default_permissions': ()}, + ), + migrations.AlterModelOptions( + name='motionpoll', + options={'default_permissions': ()}, + ), + migrations.AlterModelOptions( + name='motionversion', + options={'default_permissions': ()}, + ), + migrations.AlterModelOptions( + name='motionvote', + options={'default_permissions': ()}, + ), + migrations.AlterModelOptions( + name='state', + options={'default_permissions': ()}, + ), + migrations.AlterModelOptions( + name='workflow', + options={'default_permissions': ()}, + ), + ] diff --git a/openslides/motions/models.py b/openslides/motions/models.py index 8c23154b6..65440db6c 100644 --- a/openslides/motions/models.py +++ b/openslides/motions/models.py @@ -98,6 +98,7 @@ class Motion(RESTModelMixin, models.Model): """ class Meta: + default_permissions = () permissions = ( ('can_see', ugettext_noop('Can see motions')), ('can_create', ugettext_noop('Can create motions')), @@ -567,6 +568,7 @@ class MotionVersion(RESTModelMixin, models.Model): # note = models.TextField(null=True, blank=True) class Meta: + default_permissions = () unique_together = ("motion", "version_number") def __str__(self): @@ -596,12 +598,13 @@ class Category(RESTModelMixin, models.Model): Used to build the identifier of a motion. """ + class Meta: + default_permissions = () + ordering = ['prefix'] + def __str__(self): return self.name - class Meta: - ordering = ['prefix'] - class MotionLog(RESTModelMixin, models.Model): """Save a logmessage for a motion.""" @@ -621,6 +624,7 @@ class MotionLog(RESTModelMixin, models.Model): """The Time, when the loged action was performed.""" class Meta: + default_permissions = () ordering = ['-time'] def __str__(self): @@ -650,6 +654,9 @@ class MotionVote(RESTModelMixin, BaseVote): option = models.ForeignKey('MotionOption') """The option object, to witch the vote belongs.""" + class Meta: + default_permissions = () + def get_root_rest_element(self): """ Returns the motion to this instance which is the root REST element. @@ -668,6 +675,9 @@ class MotionOption(RESTModelMixin, BaseOption): vote_class = MotionVote """The VoteClass, to witch this Class links.""" + class Meta: + default_permissions = () + def get_root_rest_element(self): """ Returns the motion to this instance which is the root REST element. @@ -690,6 +700,9 @@ class MotionPoll(RESTModelMixin, CollectDefaultVotesMixin, BasePoll): vote_values = ['Yes', 'No', 'Abstain'] """The possible anwers for the poll. 'Yes, 'No' and 'Abstain'.""" + class Meta: + default_permissions = () + def __str__(self): """ Representation method only for debugging purposes. @@ -782,6 +795,9 @@ class State(RESTModelMixin, models.Model): this one, else it does. """ + class Meta: + default_permissions = () + def __str__(self): """Returns the name of the state.""" return self.name @@ -823,6 +839,9 @@ class Workflow(RESTModelMixin, models.Model): first_state = models.OneToOneField(State, related_name='+', null=True) """A one-to-one relation to a state, the starting point for the workflow.""" + class Meta: + default_permissions = () + def __str__(self): """Returns the name of the workflow.""" return self.name diff --git a/openslides/users/migrations/0004_auto_20151210_0016.py b/openslides/users/migrations/0004_auto_20151210_0016.py new file mode 100644 index 000000000..d7fc4f648 --- /dev/null +++ b/openslides/users/migrations/0004_auto_20151210_0016.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('users', '0003_auto_20151021_2320'), + ] + + operations = [ + migrations.AlterModelOptions( + name='user', + options={ + 'permissions': ( + ('can_see_name', 'Can see names of users'), + ('can_see_extra_data', 'Can see extra data of users'), + ('can_manage', 'Can manage users')), + 'ordering': ('last_name', 'first_name', 'username'), + 'default_permissions': ()}, + ), + ] diff --git a/openslides/users/models.py b/openslides/users/models.py index 0abee1e0f..22b0873d1 100644 --- a/openslides/users/models.py +++ b/openslides/users/models.py @@ -161,6 +161,7 @@ class User(RESTModelMixin, PermissionsMixin, AbstractBaseUser): objects = UserManager() class Meta: + default_permissions = () permissions = ( ('can_see_name', ugettext_noop('Can see names of users')), ('can_see_extra_data', ugettext_noop('Can see extra data of users')),