Verified Commit 1499a72e authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Add permission

parent 94a962f5
# Generated by Django 2.1.4 on 2018-12-19 20:46
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('documents', '0009_event_documents'),
operations = [
options={'permissions': (('override_owner', 'Can access event document as if owner'),), 'verbose_name': 'event document', 'verbose_name_plural': 'event documents'},
......@@ -128,6 +128,9 @@ class EventDocument(Document):
class Meta:
verbose_name = _('event document')
verbose_name_plural = _('event documents')
permissions = (
("override_owner", "Can access event document as if owner"),
owner = models.ForeignKey(
def is_owner(member, event_doc):
if member and member.is_authenticated:
if member.is_superuser:
if member.is_superuser or member.has_perm('documents.override_owner'):
return True
if event_doc:
if event_doc and member.has_perm('documents.change_document'):
return member.get_member_groups().filter(
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment