server/src/metaeducation/permissions.py
author ymh <ymh.work@gmail.com>
Sun, 03 Jul 2016 14:16:07 +0200
changeset 74 fa4fd5e8b54e
parent 63 6bfac7c633a0
permissions -rw-r--r--
add tracking of close + first version of tracking server side
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
63
6bfac7c633a0 Added permission management into metaeducation (instead of it being in renkanmanager) + more logging around auth code + corrected client.py for oauth server so it sends the correct content-type when using client credentials
durandn
parents:
diff changeset
     1
from rest_framework import permissions
6bfac7c633a0 Added permission management into metaeducation (instead of it being in renkanmanager) + more logging around auth code + corrected client.py for oauth server so it sends the correct content-type when using client credentials
durandn
parents:
diff changeset
     2
6bfac7c633a0 Added permission management into metaeducation (instead of it being in renkanmanager) + more logging around auth code + corrected client.py for oauth server so it sends the correct content-type when using client credentials
durandn
parents:
diff changeset
     3
class MtdcObjectPermissions(permissions.DjangoObjectPermissions):
6bfac7c633a0 Added permission management into metaeducation (instead of it being in renkanmanager) + more logging around auth code + corrected client.py for oauth server so it sends the correct content-type when using client credentials
durandn
parents:
diff changeset
     4
    """
6bfac7c633a0 Added permission management into metaeducation (instead of it being in renkanmanager) + more logging around auth code + corrected client.py for oauth server so it sends the correct content-type when using client credentials
durandn
parents:
diff changeset
     5
    Similar to `DjangoObjectPermissions`, but adding 'view' permissions.
6bfac7c633a0 Added permission management into metaeducation (instead of it being in renkanmanager) + more logging around auth code + corrected client.py for oauth server so it sends the correct content-type when using client credentials
durandn
parents:
diff changeset
     6
    """
6bfac7c633a0 Added permission management into metaeducation (instead of it being in renkanmanager) + more logging around auth code + corrected client.py for oauth server so it sends the correct content-type when using client credentials
durandn
parents:
diff changeset
     7
    perms_map = {
6bfac7c633a0 Added permission management into metaeducation (instead of it being in renkanmanager) + more logging around auth code + corrected client.py for oauth server so it sends the correct content-type when using client credentials
durandn
parents:
diff changeset
     8
        'GET': ['%(app_label)s.view_%(model_name)s'],
6bfac7c633a0 Added permission management into metaeducation (instead of it being in renkanmanager) + more logging around auth code + corrected client.py for oauth server so it sends the correct content-type when using client credentials
durandn
parents:
diff changeset
     9
        'OPTIONS': ['%(app_label)s.view_%(model_name)s'],
6bfac7c633a0 Added permission management into metaeducation (instead of it being in renkanmanager) + more logging around auth code + corrected client.py for oauth server so it sends the correct content-type when using client credentials
durandn
parents:
diff changeset
    10
        'HEAD': ['%(app_label)s.view_%(model_name)s'],
6bfac7c633a0 Added permission management into metaeducation (instead of it being in renkanmanager) + more logging around auth code + corrected client.py for oauth server so it sends the correct content-type when using client credentials
durandn
parents:
diff changeset
    11
        'POST': ['%(app_label)s.add_%(model_name)s'],
6bfac7c633a0 Added permission management into metaeducation (instead of it being in renkanmanager) + more logging around auth code + corrected client.py for oauth server so it sends the correct content-type when using client credentials
durandn
parents:
diff changeset
    12
        'PUT': ['%(app_label)s.change_%(model_name)s'],
6bfac7c633a0 Added permission management into metaeducation (instead of it being in renkanmanager) + more logging around auth code + corrected client.py for oauth server so it sends the correct content-type when using client credentials
durandn
parents:
diff changeset
    13
        'PATCH': ['%(app_label)s.change_%(model_name)s'],
6bfac7c633a0 Added permission management into metaeducation (instead of it being in renkanmanager) + more logging around auth code + corrected client.py for oauth server so it sends the correct content-type when using client credentials
durandn
parents:
diff changeset
    14
        'DELETE': ['%(app_label)s.delete_%(model_name)s'],
6bfac7c633a0 Added permission management into metaeducation (instead of it being in renkanmanager) + more logging around auth code + corrected client.py for oauth server so it sends the correct content-type when using client credentials
durandn
parents:
diff changeset
    15
    }