Completed
Push — master ( c4beda...275057 )
by
unknown
01:44
created

Publication.has_object_read_permission()   A

Complexity

Conditions 1

Size

Total Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 2
rs 10
cc 1
1
from django.db import models
2
3
from sigma_core.models.group import Group
4
from sigma_core.models.event import Event
5
from sigma_core.models.user import User
6
7
class Publication(models.Model):
8
9
    ################################################################
10
    # CONSTANTS                                                    #
11
    ################################################################
12
13
    ################################################################
14
    # FIELDS                                                       #
15
    ################################################################
16
17
    group = models.ForeignKey(Group, related_name='publications')
18
    date = models.DateTimeField(auto_now_add=True)
19
    author = models.ForeignKey(User)
20
21
    name = models.CharField(max_length=1500)
22
    content = models.CharField(max_length=1500)
23
24
    related_event = models.ForeignKey(Event, blank=True)
25
    internal = models.BooleanField(default=True)
26
    approved = models.BooleanField(default=False)
27
    last_commented = models.DateTimeField(auto_now_add=True)
28
29
    ################################################################
30
    # PERMISSIONS                                                  #
31
    ################################################################
32
33
    def has_object_read_permission(self, request):
34
        return True
35
36
    @staticmethod
37
    def has_read_permission(request):
38
        return True
39
40
    def has_object_write_permission(self, request):
41
        return True
42
43
    @staticmethod
44
    def has_write_permission(request):
45
        return True
46