Deleted Django's default permissions.

This commit is contained in:
Norman Jäckel 2015-12-10 00:20:59 +01:00
parent f98b4f7840
commit 114a38e4ee
12 changed files with 259 additions and 5 deletions

View File

@ -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': ()},
),
]

View File

@ -222,6 +222,7 @@ class Item(RESTModelMixin, models.Model):
""" """
class Meta: class Meta:
default_permissions = ()
permissions = ( permissions = (
('can_see', ugettext_noop("Can see agenda")), ('can_see', ugettext_noop("Can see agenda")),
('can_manage', ugettext_noop("Can manage agenda")), ('can_manage', ugettext_noop("Can manage agenda")),
@ -343,6 +344,7 @@ class Speaker(RESTModelMixin, models.Model):
""" """
class Meta: class Meta:
default_permissions = ()
permissions = ( permissions = (
('can_be_speaker', ugettext_noop('Can put oneself on the list of speakers')), ('can_be_speaker', ugettext_noop('Can put oneself on the list of speakers')),
) )

View File

@ -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': ()},
),
]

View File

@ -41,6 +41,7 @@ class AssignmentRelatedUser(RESTModelMixin, models.Model):
default=STATUS_CANDIDATE) default=STATUS_CANDIDATE)
class Meta: class Meta:
default_permissions = ()
unique_together = ('assignment', 'user') unique_together = ('assignment', 'user')
def __str__(self): def __str__(self):
@ -116,6 +117,7 @@ class Assignment(RESTModelMixin, models.Model):
""" """
class Meta: class Meta:
default_permissions = ()
permissions = ( permissions = (
('can_see', ugettext_noop('Can see elections')), ('can_see', ugettext_noop('Can see elections')),
('can_nominate_other', ugettext_noop('Can nominate another participant')), ('can_nominate_other', ugettext_noop('Can nominate another participant')),
@ -320,6 +322,9 @@ class Assignment(RESTModelMixin, models.Model):
class AssignmentVote(RESTModelMixin, BaseVote): class AssignmentVote(RESTModelMixin, BaseVote):
option = models.ForeignKey('AssignmentOption', related_name='votes') option = models.ForeignKey('AssignmentOption', related_name='votes')
class Meta:
default_permissions = ()
def get_root_rest_element(self): def get_root_rest_element(self):
""" """
Returns the assignment to this instance which is the root REST element. 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) candidate = models.ForeignKey(settings.AUTH_USER_MODEL)
vote_class = AssignmentVote vote_class = AssignmentVote
class Meta:
default_permissions = ()
def __str__(self): def __str__(self):
return str(self.candidate) return str(self.candidate)
@ -354,6 +362,9 @@ class AssignmentPoll(RESTModelMixin, CollectDefaultVotesMixin,
blank=True, blank=True,
verbose_name=ugettext_lazy("Comment on the ballot paper")) verbose_name=ugettext_lazy("Comment on the ballot paper"))
class Meta:
default_permissions = ()
def get_assignment(self): def get_assignment(self):
return self.assignment return self.assignment

View File

@ -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': ()},
),
]

View File

@ -61,6 +61,7 @@ class Projector(RESTModelMixin, models.Model):
""" """
Contains general permissions that can not be placed in a specific app. Contains general permissions that can not be placed in a specific app.
""" """
default_permissions = ()
permissions = ( permissions = (
('can_see_projector', ugettext_noop('Can see the projector')), ('can_see_projector', ugettext_noop('Can see the projector')),
('can_manage_projector', ugettext_noop('Can manage the projector')), ('can_manage_projector', ugettext_noop('Can manage the projector')),
@ -131,6 +132,7 @@ class CustomSlide(RESTModelMixin, models.Model):
default=0) default=0)
class Meta: class Meta:
default_permissions = ()
ordering = ('weight', 'title', ) ordering = ('weight', 'title', )
def __str__(self): def __str__(self):
@ -169,6 +171,7 @@ class Tag(RESTModelMixin, models.Model):
class Meta: class Meta:
ordering = ('name',) ordering = ('name',)
default_permissions = ()
permissions = ( permissions = (
('can_manage_tags', ugettext_noop('Can manage tags')),) ('can_manage_tags', ugettext_noop('Can manage tags')),)
@ -188,7 +191,9 @@ class ConfigStore(models.Model):
"""The value of the config variable. """ """The value of the config variable. """
class Meta: 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): class ChatMessage(RESTModelMixin, models.Model):
@ -207,6 +212,7 @@ class ChatMessage(RESTModelMixin, models.Model):
verbose_name=ugettext_lazy('User')) verbose_name=ugettext_lazy('User'))
class Meta: class Meta:
default_permissions = ()
permissions = ( permissions = (
('can_use_chat', ugettext_noop('Can use the chat')),) ('can_use_chat', ugettext_noop('Can use the chat')),)

View File

@ -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': ()},
),
]

View File

@ -30,6 +30,7 @@ class Mediafile(RESTModelMixin, models.Model):
Meta class for the mediafile model. Meta class for the mediafile model.
""" """
ordering = ['title'] ordering = ['title']
default_permissions = ()
permissions = ( permissions = (
('can_see', ugettext_noop('Can see the list of files')), ('can_see', ugettext_noop('Can see the list of files')),
('can_upload', ugettext_noop('Can upload files')), ('can_upload', ugettext_noop('Can upload files')),

View File

@ -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': ()},
),
]

View File

@ -98,6 +98,7 @@ class Motion(RESTModelMixin, models.Model):
""" """
class Meta: class Meta:
default_permissions = ()
permissions = ( permissions = (
('can_see', ugettext_noop('Can see motions')), ('can_see', ugettext_noop('Can see motions')),
('can_create', ugettext_noop('Can create motions')), ('can_create', ugettext_noop('Can create motions')),
@ -567,6 +568,7 @@ class MotionVersion(RESTModelMixin, models.Model):
# note = models.TextField(null=True, blank=True) # note = models.TextField(null=True, blank=True)
class Meta: class Meta:
default_permissions = ()
unique_together = ("motion", "version_number") unique_together = ("motion", "version_number")
def __str__(self): def __str__(self):
@ -596,12 +598,13 @@ class Category(RESTModelMixin, models.Model):
Used to build the identifier of a motion. Used to build the identifier of a motion.
""" """
class Meta:
default_permissions = ()
ordering = ['prefix']
def __str__(self): def __str__(self):
return self.name return self.name
class Meta:
ordering = ['prefix']
class MotionLog(RESTModelMixin, models.Model): class MotionLog(RESTModelMixin, models.Model):
"""Save a logmessage for a motion.""" """Save a logmessage for a motion."""
@ -621,6 +624,7 @@ class MotionLog(RESTModelMixin, models.Model):
"""The Time, when the loged action was performed.""" """The Time, when the loged action was performed."""
class Meta: class Meta:
default_permissions = ()
ordering = ['-time'] ordering = ['-time']
def __str__(self): def __str__(self):
@ -650,6 +654,9 @@ class MotionVote(RESTModelMixin, BaseVote):
option = models.ForeignKey('MotionOption') option = models.ForeignKey('MotionOption')
"""The option object, to witch the vote belongs.""" """The option object, to witch the vote belongs."""
class Meta:
default_permissions = ()
def get_root_rest_element(self): def get_root_rest_element(self):
""" """
Returns the motion to this instance which is the root REST element. Returns the motion to this instance which is the root REST element.
@ -668,6 +675,9 @@ class MotionOption(RESTModelMixin, BaseOption):
vote_class = MotionVote vote_class = MotionVote
"""The VoteClass, to witch this Class links.""" """The VoteClass, to witch this Class links."""
class Meta:
default_permissions = ()
def get_root_rest_element(self): def get_root_rest_element(self):
""" """
Returns the motion to this instance which is the root REST element. 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'] vote_values = ['Yes', 'No', 'Abstain']
"""The possible anwers for the poll. 'Yes, 'No' and 'Abstain'.""" """The possible anwers for the poll. 'Yes, 'No' and 'Abstain'."""
class Meta:
default_permissions = ()
def __str__(self): def __str__(self):
""" """
Representation method only for debugging purposes. Representation method only for debugging purposes.
@ -782,6 +795,9 @@ class State(RESTModelMixin, models.Model):
this one, else it does. this one, else it does.
""" """
class Meta:
default_permissions = ()
def __str__(self): def __str__(self):
"""Returns the name of the state.""" """Returns the name of the state."""
return self.name return self.name
@ -823,6 +839,9 @@ class Workflow(RESTModelMixin, models.Model):
first_state = models.OneToOneField(State, related_name='+', null=True) first_state = models.OneToOneField(State, related_name='+', null=True)
"""A one-to-one relation to a state, the starting point for the workflow.""" """A one-to-one relation to a state, the starting point for the workflow."""
class Meta:
default_permissions = ()
def __str__(self): def __str__(self):
"""Returns the name of the workflow.""" """Returns the name of the workflow."""
return self.name return self.name

View File

@ -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': ()},
),
]

View File

@ -161,6 +161,7 @@ class User(RESTModelMixin, PermissionsMixin, AbstractBaseUser):
objects = UserManager() objects = UserManager()
class Meta: class Meta:
default_permissions = ()
permissions = ( permissions = (
('can_see_name', ugettext_noop('Can see names of users')), ('can_see_name', ugettext_noop('Can see names of users')),
('can_see_extra_data', ugettext_noop('Can see extra data of users')), ('can_see_extra_data', ugettext_noop('Can see extra data of users')),