This file is indexed.

/usr/lib/python3/dist-packages/maasserver/urls.py is in python3-django-maas 2.4.0~beta2-6865-gec43e47e6-0ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# Copyright 2012-2016 Canonical Ltd.  This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).

"""URL routing configuration."""

__all__ = []


from django.conf.urls import (
    include,
    url,
)
from django.contrib.auth.decorators import user_passes_test
from django.http import HttpResponse
from maasserver import (
    urls_api,
    urls_combo,
)
from maasserver.bootresources import (
    simplestreams_file_handler,
    simplestreams_stream_handler,
)
from maasserver.macaroon_auth import MacaroonDischargeRequest
from maasserver.views import (
    settings,
    TextTemplateView,
)
from maasserver.views.account import (
    authenticate,
    login,
    logout,
)
from maasserver.views.index import IndexView
from maasserver.views.prefs import (
    SSLKeyCreateView,
    SSLKeyDeleteView,
    userprefsview,
)
from maasserver.views.rpc import info
from maasserver.views.settings import (
    AccountsAdd,
    AccountsDelete,
    AccountsEdit,
    AccountsView,
)
from maasserver.views.settings_commissioning_scripts import (
    CommissioningScriptCreate,
    CommissioningScriptDelete,
)
from maasserver.views.settings_license_keys import (
    LicenseKeyCreate,
    LicenseKeyDelete,
    LicenseKeyEdit,
)
from maasserver.views.settings_test_scripts import (
    TestScriptCreate,
    TestScriptDelete,
)


def adminurl(regexp, view, *args, **kwargs):
    view = user_passes_test(lambda u: u.is_superuser)(view)
    return url(regexp, view, *args, **kwargs)


# # URLs accessible to anonymous users.
# Combo URLs.
urlpatterns = [
    url(r'combo/', include(urls_combo))
]

# Anonymous views.
urlpatterns += [
    url(r'^accounts/login/$', login, name='login'),
    url(r'^accounts/authenticate/$', authenticate, name='authenticate'),
    url(
        r'^accounts/discharge-request/$', MacaroonDischargeRequest(),
        name='discharge-request'),
    url(
        r'^images-stream/streams/v1/(?P<filename>.*)$',
        simplestreams_stream_handler, name='simplestreams_stream_handler'),
    url(
        r'^images-stream/(?P<os>.*)/(?P<arch>.*)/(?P<subarch>.*)/'
        '(?P<series>.*)/(?P<version>.*)/(?P<filename>.*)$',
        simplestreams_file_handler, name='simplestreams_file_handler'),
    url(
        r'^robots\.txt$', TextTemplateView.as_view(
            template_name='maasserver/robots.txt'),
        name='robots'),
]

# # URLs for logged-in users.
# Preferences views.
urlpatterns += [
    url(r'^account/prefs/$', userprefsview, name='prefs'),
    url(
        r'^account/prefs/sslkey/add/$', SSLKeyCreateView.as_view(),
        name='prefs-add-sslkey'),
    url(
        r'^account/prefs/sslkey/delete/(?P<keyid>\d*)/$',
        SSLKeyDeleteView.as_view(), name='prefs-delete-sslkey'),
]
# Logout view.
urlpatterns += [
    url(r'^accounts/logout/$', logout, name='logout'),
]


# Index view.
urlpatterns += [
    url(
        r'^$',
        IndexView.as_view(),
        name='index'),
]

# # URLs for admin users.
# Settings views.
urlpatterns += [
    adminurl(r'^settings/$', settings.settings, name='settings'),
    adminurl(r'^settings/users/$', settings.users, name='settings_users'),
    adminurl(
        r'^settings/general/$', settings.general, name='settings_general'),
    adminurl(
        r'^settings/scripts/$', settings.scripts, name='settings_scripts'),
    adminurl(
        r'^settings/storage/$', settings.storage, name='settings_storage'),
    adminurl(
        r'^settings/network/$', settings.network, name='settings_network'),
    adminurl(
        r'^settings/license-keys/$', settings.license_keys,
        name='settings_license_keys'),
    adminurl(r'^accounts/add/$', AccountsAdd.as_view(), name='accounts-add'),
    adminurl(
        r'^accounts/(?P<username>[^/]+)/edit/$', AccountsEdit.as_view(),
        name='accounts-edit'),
    adminurl(
        r'^accounts/(?P<username>[^/]+)/view/$', AccountsView.as_view(),
        name='accounts-view'),
    adminurl(
        r'^accounts/(?P<username>[^/]+)/del/$', AccountsDelete.as_view(),
        name='accounts-del'),
    adminurl(
        r'^commissioning-scripts/(?P<id>[\w\-]+)/delete/$',
        CommissioningScriptDelete.as_view(),
        name='commissioning-script-delete'),
    adminurl(
        r'^commissioning-scripts/add/$',
        CommissioningScriptCreate.as_view(),
        name='commissioning-script-add'),
    adminurl(
        r'^test-scripts/(?P<id>[\w\-]+)/delete/$',
        TestScriptDelete.as_view(),
        name='test-script-delete'),
    adminurl(
        r'^test-scripts/add/$',
        TestScriptCreate.as_view(),
        name='test-script-add'),
    adminurl(
        r'^license-key/(?P<osystem>[^/]+)/(?P<distro_series>[^/]+)/delete/$',
        LicenseKeyDelete.as_view(),
        name='license-key-delete'),
    adminurl(
        r'^license-key/(?P<osystem>[^/]+)/(?P<distro_series>[^/]+)/edit/$',
        LicenseKeyEdit.as_view(),
        name='license-key-edit'),
    adminurl(
        r'^license-key/add/$',
        LicenseKeyCreate.as_view(),
        name='license-key-add'),
]

# API URLs. If old API requested, provide error message directing to new API.
urlpatterns += [
    url(r'^api/2\.0/', include(urls_api)),
    url(r'^api/version/', lambda request: HttpResponse(
        content='2.0', content_type="text/plain"), name='api_version'),
    url(r'^api/1.0/', lambda request: HttpResponse(
        content_type="text/plain", status=410,
        content='The 1.0 API is no longer available. '
        'Please use API version 2.0.'), name='api_v1_error'),
]


# RPC URLs.
urlpatterns += [
    url(r'^rpc/$', info, name="rpc-info"),
]