djangoldp_urls.py 2.04 KB
Newer Older
1
"""djangoldp project URL Configuration"""
2 3

from django.conf import settings
Jean-Baptiste's avatar
Jean-Baptiste committed
4
from django.conf.urls import url, include
5
from django.contrib.auth.models import Group
6
from django.views.decorators.csrf import csrf_exempt
7

8
from djangoldp.permissions import LDPPermissions
9
from djangoldp.views import LDPViewSet
10
from djangoldp_account.forms import LDPUserForm
11
from .models import ChatProfile, Account
Calum Mackervoy's avatar
Calum Mackervoy committed
12 13
from .views import userinfocustom, RPLoginView, RPLoginCallBackView, check_user, LDPAccountLoginView, RedirectView, \
    LDPAccountRegsitrationView
14

Jean-Baptiste Pasquier's avatar
Jean-Baptiste Pasquier committed
15 16 17 18 19
Group._meta.serializer_fields = ['name']
Group._meta.anonymous_perms = getattr(settings, 'GROUP_ANONYMOUS_PERMISSIONS', ['view'])
Group._meta.authenticated_perms = getattr(settings, 'GROUP_AUTHENTICATED_PERMISSIONS', ['inherit'])
Group._meta.owner_perms = getattr(settings, 'GROUP_OWNER_PERMISSIONS', ['inherit'])

20
urlpatterns = [
21
    url(r'^groups/',
22 23
        LDPViewSet.urls(model=Group, fields=['@id', 'name', 'user_set'],
                        permission_classes=getattr(settings, 'GROUP_PERMISSION_CLASSES', [LDPPermissions]),
24 25
        )
    ),
26
    url(r'^auth/register/$',
Calum Mackervoy's avatar
Calum Mackervoy committed
27
        LDPAccountRegsitrationView.as_view(
28 29 30
            form_class=LDPUserForm
        ),
        name='django_registration_register',
31
    ),
Calum Mackervoy's avatar
Calum Mackervoy committed
32
    url(r'^auth/login/$', LDPAccountLoginView.as_view(),name='login'),
33 34
    url(r'^auth/', include('django_registration.backends.activation.urls')),
    url(r'^auth/', include('django.contrib.auth.urls')),
35 36
    url(r'^accounts/', LDPViewSet.urls(model=Account, permission_classes=[LDPPermissions])),
    url(r'^chat-profile/', LDPViewSet.urls(model=ChatProfile, permission_classes=[LDPPermissions])),
37 38
    url(r'^oidc/login/callback/?$', RPLoginCallBackView.as_view(), name='oidc_login_callback'),
    url(r'^oidc/login/?$', RPLoginView.as_view(), name='oidc_login'),
39
    url(r'^userinfo/?$', csrf_exempt(userinfocustom)),
40
    url(r'^check-user/?$', csrf_exempt(check_user)),
Calum Mackervoy's avatar
Calum Mackervoy committed
41
    url(r'^redirect-default/$', RedirectView.as_view(),name='redirect-default'),
42
    url(r'^', include('oidc_provider.urls', namespace='oidc_provider'))
43
]