urls.py 8.3 KB
Newer Older
Antony Chazapis's avatar
Antony Chazapis committed
1
# Copyright 2011-2012 GRNET S.A. All rights reserved.
2
#
3
4
5
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
# conditions are met:
6
#
7
8
9
#   1. Redistributions of source code must retain the above
#      copyright notice, this list of conditions and the following
#      disclaimer.
10
#
11
12
13
14
#   2. Redistributions in binary form must reproduce the above
#      copyright notice, this list of conditions and the following
#      disclaimer in the documentation and/or other materials
#      provided with the distribution.
15
#
16
17
18
19
20
21
22
23
24
25
26
27
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
28
#
29
30
31
32
33
# The views and conclusions contained in the software and
# documentation are those of the authors and should not be
# interpreted as representing official policies, either expressed
# or implied, of GRNET S.A.

34
from django.conf.urls.defaults import patterns, url
35

Olga Brani's avatar
Olga Brani committed
36
37
38
from astakos.im.forms import (ExtendedPasswordResetForm,
                              ExtendedPasswordChangeForm,
                              ExtendedSetPasswordForm, LoginForm)
39
from astakos.im.settings import IM_MODULES, INVITATIONS_ENABLED, EMAILCHANGE_ENABLED
40

41
urlpatterns = patterns('astakos.im.views',
42
43
44
45
46
                       url(r'^$', 'index', {}, name='index'),
                       url(r'^login/?$', 'index', {}, name='login'),
                       url(r'^profile/?$',
                           'edit_profile', {}, name='edit_profile'),
                       url(r'^feedback/?$', 'feedback', {}, name='feedback'),
47
48
49
50
51
52
53
54
                       url(r'^signup/?$', 'signup',
                           {'on_success': 'im/login.html',
                            'extra_context': {'login_form': LoginForm()}},
                           name='signup'),
                       url(r'^logout/?$', 'logout',
                           {'template': 'im/login.html',
                            'extra_context': {'login_form': LoginForm()}},
                           name='logout'),
55
56
57
58
59
60
61
62
63
64
                       url(r'^activate/?$', 'activate', {}, name='activate'),
                       url(r'^approval_terms/?$',
                           'approval_terms', {}, name='latest_terms'),
                       url(r'^approval_terms/(?P<term_id>\d+)/?$',
                           'approval_terms'),
                       url(r'^password/?$',
                           'change_password', {}, name='password_change'),
                       url(r'^resources/?$',
                           'resource_list', {}, name='resource_list'),
                       url(r'^billing/?$', 'billing', {}, name='billing'),
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
65
                       url(r'^timeline/?$', 'timeline', {}, name='timeline'),
66
67
68
69
                       url(r'^group/add/(?P<kind_name>\w+)?$',
                           'group_add', {}, name='group_add'),
                       url(r'^group/list/?$',
                           'group_list', {}, name='group_list'),
70
71
                       url(r'^group/(?P<group_id>\d+)/?$', 'group_detail',
                           {}, name='group_detail'),
72
73
                       url(r'^group/search/?$',
                           'group_search', {}, name='group_search'),
74
75
                       url(r'^group/all/?$',
                           'group_all', {}, name='group_all'),
76
77
78
79
                       url(r'^group/(?P<group_id>\d+)/join/?$', 'group_join',
                           {}, name='group_join'),
                       url(r'^group/(?P<group_id>\d+)/leave/?$', 'group_leave',
                           {}, name='group_leave'),
Olga Brani's avatar
Olga Brani committed
80
81
                       url(
                           r'^group/(?P<group_id>\d+)/(?P<user_id>\d+)/approve/?$',
82
                           'approve_member', {}, name='approve_member'),
Olga Brani's avatar
Olga Brani committed
83
84
                       url(
                           r'^group/(?P<group_id>\d+)/(?P<user_id>\d+)/disapprove/?$',
85
                           'disapprove_member', {}, name='disapprove_member'),
86
87
                       url(r'^group/create/?$', 'group_create_list', {},
                           name='group_create_list'),
Olga Brani's avatar
Olga Brani committed
88
89
                       url(r'^group/create_demo/?$', 'group_create_demo', {},
                           name='group_create_demo'),
90
                       )
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
91

92
93
if EMAILCHANGE_ENABLED:
    urlpatterns += patterns('astakos.im.views',
94
95
96
97
98
99
100
                            url(r'^email_change/?$',
                                'change_email', {}, name='email_change'),
                            url(
                            r'^email_change/confirm/(?P<activation_key>\w+)/', 'change_email', {},
                            name='email_change_confirm')
                            )

101
urlpatterns += patterns('astakos.im.target',
102
103
                        url(r'^login/redirect/?$', 'redirect.login')
                        )
104

Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
105
if 'local' in IM_MODULES:
106
    urlpatterns += patterns('astakos.im.target',
107
108
                            url(r'^local/?$', 'local.login')
                            )
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
109
    urlpatterns += patterns('django.contrib.auth.views',
110
111
112
113
114
115
116
                            url(r'^local/password_reset/?$', 'password_reset',
                                {'email_template_name': 'registration/password_email.txt',
                                 'password_reset_form': ExtendedPasswordResetForm}),
                            url(r'^local/password_reset_done/?$',
                                'password_reset_done'),
                            url(
                                r'^local/reset/confirm/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/?$',
Olga Brani's avatar
Olga Brani committed
117
                            'password_reset_confirm', {'set_password_form': ExtendedSetPasswordForm}),
118
119
120
121
122
123
                            url(r'^local/password/reset/complete/?$',
                                'password_reset_complete'),
                            url(
                            r'^password_change/?$', 'password_change', {'post_change_redirect': 'profile',
                                                                        'password_change_form': ExtendedPasswordChangeForm})
                            )
124

Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
125
if INVITATIONS_ENABLED:
126
    urlpatterns += patterns('astakos.im.views',
127
128
                            url(r'^invite/?$', 'invite', {}, name='invite')
                            )
129

Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
130
if 'shibboleth' in IM_MODULES:
131
    urlpatterns += patterns('astakos.im.target',
132
133
                            url(r'^login/shibboleth/?$', 'shibboleth.login')
                            )
134

Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
135
if 'twitter' in IM_MODULES:
136
    urlpatterns += patterns('astakos.im.target',
137
138
139
140
                            url(r'^login/twitter/?$', 'twitter.login'),
                            url(r'^login/twitter/authenticated/?$',
                                'twitter.authenticated')
                            )
141

Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
142
urlpatterns += patterns('astakos.im.api',
143
144
145
                        url(r'^get_services/?$', 'get_services'),
                        url(r'^get_menu/?$', 'get_menu'),
                        )
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
146

147
urlpatterns += patterns('astakos.im.api.admin',
148
149
150
151
152
153
                        url(r'^authenticate/?$', 'authenticate_old'),
                        #url(r'^authenticate/v2/?$', 'authenticate'),
                        url(r'^admin/api/v2.0/users/?$', 'get_user_by_email'),
                        url(r'^admin/api/v2.0/users/(?P<user_id>.+?)/?$',
                            'get_user_by_username'),
                        )
154
155

urlpatterns += patterns('astakos.im.api.service',
156
157
158
159
160
161
162
                        #url(r'^service/api/v2.0/tokens/(?P<token_id>.+?)/?$', 'validate_token'),
                        url(r'^service/api/v2.0/feedback/?$', 'send_feedback'),
                        url(r'^service/api/v2.0/users/?$',
                            'get_user_by_email'),
                        url(r'^service/api/v2.0/users/(?P<user_id>.+?)/?$',
                            'get_user_by_username'),
                        )