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

SharedPublication   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 4
c 1
b 0
f 1
dl 0
loc 29
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A has_object_write_permission() 0 2 1
A has_object_read_permission() 0 2 1
A has_read_permission() 0 3 1
A has_write_permission() 0 3 1
1
from django.db import models
2
3
from sigma_core.models.publication import Publication
4
from sigma_core.models.group import Group
5
6
class SharedPublication(models.Model):
7
8
    ################################################################
9
    # CONSTANTS                                                    #
10
    ################################################################
11
12
    # Liste des champs de l'objet
13
    publication = models.ForeignKey(Publication, related_name='shared')
14
    group = models.ForeignKey(Group, related_name='shared_publications')
15
    approved = models.BooleanField(default=False)
16
    date = models.DateTimeField(auto_now_add=True)
17
18
    ################################################################
19
    # PERMISSIONS                                                  #
20
    ################################################################
21
22
    def has_object_read_permission(self, request):
23
        return True
24
25
    @staticmethod
26
    def has_read_permission(request):
27
        return True
28
29
    def has_object_write_permission(self, request):
30
        return True
31
32
    @staticmethod
33
    def has_write_permission(request):
34
        return True
35