Ejemplo n.º 1
0
    def test_public_decorator_works_with_partials(self):
        def function():
            pass
        partial = functools.partial(function)

        decorators.public(partial)

        self.assertTrue(function.STRONGHOLD_IS_PUBLIC)
Ejemplo n.º 2
0
    def test_public_decorator_works_with_partials(self):
        def function():
            pass

        partial = functools.partial(function)

        decorators.public(partial)

        self.assertTrue(function.STRONGHOLD_IS_PUBLIC)
Ejemplo n.º 3
0
    def test_that_public_view_is_allowed_for_normal_user(self):
        """Test that normal user is allowed for an public view"""
        kwargs = dict(self.kwargs)
        kwargs['view_func'] = public(HttpResponse)

        response = self.middleware.process_view(self.request, **kwargs)
        self.assertIsNone(response)
Ejemplo n.º 4
0
    def test_that_public_view_is_allowed_for_normal_user(self):
        """Test that normal user is allowed for an public view"""
        kwargs = dict(self.kwargs)
        kwargs['view_func'] = public(HttpResponse)

        response = self.middleware.process_view(self.request, **kwargs)
        self.assertIsNone(response)
Ejemplo n.º 5
0
    def test_that_public_view_is_allowed_for_normal_user(
            web_request, middleware, kwargs):
        """Test that normal user is allowed for an public view"""
        kwargs = dict(kwargs)
        kwargs['view_func'] = public(HttpResponse)

        response = middleware.process_view(web_request, **kwargs)
        assert response is None
Ejemplo n.º 6
0
    def _test_view_factory(self, test_object=None):
        def test_view(request):
            template = Template(template_string=self.test_view_template)
            context = Context(
                dict_={'object': test_object, 'resolved_object': test_object}
            )
            return HttpResponse(template.render(context=context))

        if self.test_view_is_public:
            return public(function=test_view)
        else:
            return test_view
Ejemplo n.º 7
0
# SPDX-License-Identifier: AGPL-3.0-or-later
from django.urls import path
from plinth.utils import non_admin_view
from stronghold.decorators import public
from . import views


urlpatterns = [
    path('apps/email_server/', views.EmailServerView.as_view(), name='index'),
    path('apps/email_server/security', views.TLSView.as_view()),
    path('apps/email_server/domains', views.DomainView.as_view()),

    path('apps/email_server/my_mail',
         non_admin_view(views.MyMailView.as_view()), name='my_mail'),
    path('apps/email_server/my_aliases',
         non_admin_view(views.AliasView.as_view())),

    path('apps/email_server/config.xml', public(views.XmlView.as_view())),
]
Ejemplo n.º 8
0
 def test_public_decorator_sets_attr(self):
     view_func = Mock()
     view_func = public(view_func)
     is_public = getattr(view_func, 'STRONGHOLD_IS_PUBLIC', None)
     self.assertEqual(is_public, True)
Ejemplo n.º 9
0
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

"""
URLs for the First Boot module
"""

from django.conf.urls import url
from stronghold.decorators import public

from .views import State0View, State1View, State5View, state10


urlpatterns = [
    # Take care of the firstboot middleware when changing URLs
    url(r"^firstboot/$", public(State0View.as_view()), name="index"),
    url(r"^firstboot/state0/$", public(State0View.as_view()), name="state0"),
    url(r"^firstboot/state1/$", public(State1View.as_view()), name="state1"),
    url(r"^firstboot/state5/$", State5View.as_view(), name="state5"),
    url(r"^firstboot/state10/$", state10, name="state10"),
]
Ejemplo n.º 10
0
import django.contrib.auth.views as auth_views
from django.urls import include, path
from stronghold.decorators import public

import apps.user.views as user_views


app_name = "user"
urlpatterns = [
    path("welcome/", public(user_views.Welcome.as_view()), name="welcome"),
    path("signup/", public(user_views.Signup.as_view()), name="signup"),
    path("login/", public(user_views.Login.as_view()), name="login"),
    path("logout/", auth_views.logout_then_login, name="logout"),
]
Ejemplo n.º 11
0
from django.conf.urls import url
from django.urls import reverse_lazy

from axes.decorators import axes_dispatch
from plinth.modules.sso.views import SSOLoginView, SSOLogoutView
from plinth.utils import non_admin_view
from stronghold.decorators import public

from . import views

urlpatterns = [
    url(r'^sys/users/$', views.UserList.as_view(), name='index'),
    url(r'^sys/users/create/$', views.UserCreate.as_view(), name='create'),
    url(r'^sys/users/(?P<slug>[\w.@+-]+)/edit/$',
        non_admin_view(views.UserUpdate.as_view()), name='edit'),
    url(r'^sys/users/(?P<slug>[\w.@+-]+)/delete/$',
        views.UserDelete.as_view(), name='delete'),
    url(r'^sys/users/(?P<slug>[\w.@+-]+)/change_password/$',
        non_admin_view(views.UserChangePassword.as_view()),
        name='change_password'),

    # Authnz is handled by SSO
    url(r'^accounts/login/$',
        public(axes_dispatch(SSOLoginView.as_view())), name='login'),
    url(r'^accounts/logout/$',
        non_admin_view(SSOLogoutView.as_view()),
        {'next_page': reverse_lazy('index')}, name='logout'),
    url(r'^users/firstboot/$',
        public(views.FirstBootView.as_view()), name='firstboot'),
]
Ejemplo n.º 12
0
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
"""
URLs for the Single Sign On module.
"""

from django.conf.urls import url

from .views import SSOLoginView, refresh
from stronghold.decorators import public
from plinth.utils import non_admin_view

urlpatterns = [
    url(r'^accounts/sso/login/$',
        public(SSOLoginView.as_view()), name='sso-login'),
    url(r'^accounts/sso/refresh/$', non_admin_view(refresh),
        name='sso-refresh'),
]
Ejemplo n.º 13
0
# SPDX-License-Identifier: AGPL-3.0-or-later
"""
URLs for the Single Sign On module.
"""

from axes.decorators import axes_dispatch
from django.urls import re_path
from stronghold.decorators import public

from plinth.utils import non_admin_view

from .views import CaptchaLoginView, SSOLoginView, refresh

urlpatterns = [
    re_path(r'^accounts/sso/login/$',
            public(axes_dispatch(SSOLoginView.as_view())),
            name='sso-login'),
    re_path(r'^accounts/sso/refresh/$',
            non_admin_view(refresh),
            name='sso-refresh'),

    # Locked URL from django-axes
    re_path(r'accounts/sso/login/locked/$',
            public(CaptchaLoginView.as_view()),
            name='locked_out'),
]
Ejemplo n.º 14
0
"""
URLs for the Users module
"""

from django.conf.urls import url
from django.urls import reverse_lazy
from stronghold.decorators import public

from plinth.utils import non_admin_view
from plinth.modules.sso.views import SSOLoginView, SSOLogoutView
from . import views


urlpatterns = [
    url(r'^sys/users/$', views.UserList.as_view(), name='index'),
    url(r'^sys/users/create/$', views.UserCreate.as_view(), name='create'),
    url(r'^sys/users/(?P<slug>[\w.@+-]+)/edit/$',
        non_admin_view(views.UserUpdate.as_view()), name='edit'),
    url(r'^sys/users/(?P<slug>[\w.@+-]+)/delete/$', views.UserDelete.as_view(),
        name='delete'),
    url(r'^sys/users/(?P<slug>[\w.@+-]+)/change_password/$',
        non_admin_view(views.UserChangePassword.as_view()),
        name='change_password'),
    # Add Django's login/logout urls
    url(r'^accounts/login/$', public(SSOLoginView.as_view()), name='login'),
    url(r'^accounts/logout/$', non_admin_view(SSOLogoutView.as_view()),
        {'next_page': reverse_lazy('index')}, name='logout'),
    url(r'^users/firstboot/$', public(views.FirstBootView.as_view()),
        name='firstboot'),
]
Ejemplo n.º 15
0
from plinth.modules.sso.views import SSOLoginView, SSOLogoutView
from . import views

from axes.decorators import watch_login

urlpatterns = [
    url(r'^sys/users/$', views.UserList.as_view(), name='index'),
    url(r'^sys/users/create/$', views.UserCreate.as_view(), name='create'),
    url(r'^sys/users/(?P<slug>[\w.@+-]+)/edit/$',
        non_admin_view(views.UserUpdate.as_view()),
        name='edit'),
    url(r'^sys/users/(?P<slug>[\w.@+-]+)/delete/$',
        views.UserDelete.as_view(),
        name='delete'),
    url(r'^sys/users/(?P<slug>[\w.@+-]+)/change_password/$',
        non_admin_view(views.UserChangePassword.as_view()),
        name='change_password'),

    # Authnz is handled by SSO
    url(r'^accounts/login/$',
        public(watch_login(SSOLoginView.as_view())),
        name='login'),
    url(r'^accounts/logout/$',
        non_admin_view(SSOLogoutView.as_view()),
        {'next_page': reverse_lazy('index')},
        name='logout'),
    url(r'^users/firstboot/$',
        public(views.FirstBootView.as_view()),
        name='firstboot'),
]
Ejemplo n.º 16
0
from django.conf.urls import url
from django.contrib.auth import views as auth_views
from django.urls import reverse_lazy
from stronghold.decorators import public

from . import views

urlpatterns = [
    url(r'^sys/users/$', views.UserList.as_view(), name='index'),
    url(r'^sys/users/create/$', views.UserCreate.as_view(), name='create'),
    url(r'^sys/users/(?P<slug>[\w.@+-]+)/edit/$',
        views.UserUpdate.as_view(),
        name='edit'),
    url(r'^sys/users/(?P<slug>[\w.@+-]+)/delete/$',
        views.UserDelete.as_view(),
        name='delete'),
    url(r'^sys/users/(?P<slug>[\w.@+-]+)/change_password/$',
        views.UserChangePassword.as_view(),
        name='change_password'),
    # Add Django's login/logout urls
    url(r'^accounts/login/$',
        auth_views.login, {'template_name': 'login.html'},
        name='login'),
    url(r'^accounts/logout/$',
        auth_views.logout, {'next_page': reverse_lazy('index')},
        name='logout'),
    url(r'^users/firstboot/$',
        public(views.FirstBootView.as_view()),
        name='firstboot'),
]
Ejemplo n.º 17
0
# SPDX-License-Identifier: AGPL-3.0-or-later
"""
URLs for the First Boot module
"""

from django.conf.urls import url
from stronghold.decorators import public

from .views import CompleteView, WelcomeView

urlpatterns = [
    # Take care of the firstboot middleware when changing URLs
    url(r'^firstboot/$', public(WelcomeView.as_view()), name='index'),
    url(r'^firstboot/welcome/$', public(WelcomeView.as_view()),
        name='welcome'),
    url(r'^firstboot/complete/$', CompleteView.as_view(), name='complete'),
]
Ejemplo n.º 18
0
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Add an import:  from blog import urls as blog_urls
    2. Add a URL to urlpatterns:  url(r'^blog/', include(blog_urls))
"""
from django.conf.urls import include, url, patterns
from django.contrib import admin
from django.contrib.auth.views import login, logout, password_reset, password_reset_done, password_reset_confirm, password_reset_complete
from school.views import *
from stronghold.decorators import public
from django.views.generic import RedirectView
#from django.conf import settings

urlpatterns = [
    #url(r'^account/', include('django.contrib.auth.urls')),
    url(r'^user/login/$',  public(login),  name='login'),
    url(r'^user/logout/$',  public(logout),  {'next_page': '/school/'}, name='logout'),
    url(r'^user/password/reset/$', public(password_reset), {'post_reset_redirect' : '/user/password/reset/done/'}, name="password_reset"),
    url(r'^user/password/reset/done/$', public(password_reset_done), name='password_reset_done'),
    url(r'^user/password/reset/(?P<uidb64>[0-9A-Za-z]+)-(?P<token>.+)/$', public(password_reset_confirm), {'post_reset_redirect' : '/user/password/done/'}, name="password_reset_confirm"),
    url(r'^user/password/done/$', public(password_reset_complete)),
    url(r'^admin/logout/$', 'django.contrib.auth.views.logout', {'next_page': '/school/'}),
    url(r'^admin/', include(admin.site.urls)),
    url(r'^grappelli/', include('grappelli.urls')),
    url(r'^accounts/login/$', public(RedirectView.as_view(url='/user/login/'))),
    url(r'^school/', include('school.urls')),
    url(r'^report_builder/', include('report_builder.urls')) ,
    url(r'^$', public(RedirectView.as_view(url='/school/'))),
    url(r'^impersonate/', include('impersonate.urls')),
]
Ejemplo n.º 19
0
from django.conf.urls import patterns, url

from . import views

from stronghold.decorators import public


urlpatterns = patterns('',
    url(r'^$',
        public(views.HomeView.as_view()),
        name="home"),
)
Ejemplo n.º 20
0
# This file is part of Plinth.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
"""
URLs for the Single Sign On module.
"""

from django.conf.urls import url

from .views import SSOLoginView, refresh
from stronghold.decorators import public

urlpatterns = [
    url(r'^accounts/sso/login/$',
        public(SSOLoginView.as_view()),
        name='sso-login'),
    url(r'^accounts/sso/refresh/$', refresh, name='sso-refresh'),
]
Ejemplo n.º 21
0
from . import views

urlpatterns = [
    url(r'^sys/users/$', views.UserList.as_view(), name='index'),
    url(r'^sys/users/create/$', views.UserCreate.as_view(), name='create'),
    url(r'^sys/users/(?P<slug>[\w.@+-]+)/edit/$',
        non_admin_view(views.UserUpdate.as_view()),
        name='edit'),
    url(r'^sys/users/(?P<slug>[\w.@+-]+)/delete/$',
        views.UserDelete.as_view(),
        name='delete'),
    url(r'^sys/users/(?P<slug>[\w.@+-]+)/change_password/$',
        non_admin_view(views.UserChangePassword.as_view()),
        name='change_password'),

    # Authnz is handled by SSO

    # XXX: Use axes authentication backend and middleware instead of
    # axes_dispatch after axes 5.x becomes available in Debian stable.
    url(r'^accounts/login/$',
        public(axes_dispatch(SSOLoginView.as_view())),
        name='login'),
    url(r'^accounts/logout/$',
        non_admin_view(SSOLogoutView.as_view()),
        {'next_page': reverse_lazy('index')},
        name='logout'),
    url(r'^users/firstboot/$',
        public(views.FirstBootView.as_view()),
        name='firstboot'),
]
Ejemplo n.º 22
0
from django.urls import path
from stronghold.decorators import public

import apps.marketing.views as marketing_views

app_name = 'marketing'
urlpatterns = [
    path('', public(marketing_views.Landing.as_view()), name='landing')
]
Ejemplo n.º 23
0
# SPDX-License-Identifier: AGPL-3.0-or-later
"""
URLs for the plinth api for android app.
"""

from django.urls import re_path
from stronghold.decorators import public

from plinth.modules.api import views

urlpatterns = [
    re_path(r'^api/(?P<version>[0-9]+)/shortcuts/?$', public(views.shortcuts)),
    re_path(r'^api/(?P<version>[0-9]+)/access-info/?$',
            public(views.access_info)),
]
Ejemplo n.º 24
0
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

"""
URLs for the First Boot module
"""

from django.conf.urls import url
from stronghold.decorators import public

from .views import WelcomeView, CompleteView


urlpatterns = [
    # Take care of the firstboot middleware when changing URLs
    url(r'^firstboot/$', public(WelcomeView.as_view()), name='index'),
    url(r'^firstboot/welcome/$', public(WelcomeView.as_view()),
        name='welcome'),
    url(r'^firstboot/complete/$', CompleteView.as_view(), name='complete'),
]
Ejemplo n.º 25
0
# SPDX-License-Identifier: AGPL-3.0-or-later
"""
URLs for the JSXC module
"""

from django.conf.urls import url
from stronghold.decorators import public

from plinth.views import AppView

from .views import JsxcView

urlpatterns = [
    url(r'^apps/jsxc/$', AppView.as_view(app_id='jsxc'), name='index'),
    url(r'^apps/jsxc/jsxc/$', public(JsxcView.as_view()), name='jsxc')
]
Ejemplo n.º 26
0
from django.conf.urls import url
from django.urls import reverse_lazy

from axes.decorators import axes_dispatch
from plinth.modules.sso.views import SSOLoginView, SSOLogoutView
from plinth.utils import non_admin_view
from stronghold.decorators import public

from . import views

urlpatterns = [
    url(r'^sys/users/$', views.UserList.as_view(), name='index'),
    url(r'^sys/users/create/$', views.UserCreate.as_view(), name='create'),
    url(r'^sys/users/(?P<slug>[\w.@+-]+)/edit/$',
        non_admin_view(views.UserUpdate.as_view()), name='edit'),
    url(r'^sys/users/(?P<slug>[\w.@+-]+)/delete/$',
        views.UserDelete.as_view(), name='delete'),
    url(r'^sys/users/(?P<slug>[\w.@+-]+)/change_password/$',
        non_admin_view(views.UserChangePassword.as_view()),
        name='change_password'),

    # Authnz is handled by SSO
    url(r'^accounts/login/$',
        public(axes_dispatch(SSOLoginView.as_view())), name='login'),
    url(r'^accounts/logout/$',
        non_admin_view(SSOLogoutView.as_view()),
        {'next_page': reverse_lazy('index')}, name='logout'),
    url(r'^users/firstboot/$',
        public(views.FirstBootView.as_view()), name='firstboot'),
]
Ejemplo n.º 27
0
import django.contrib.auth.views as auth_views
from django.urls import path
from stronghold.decorators import public

import apps.user.views as user_views

app_name = 'user'
urlpatterns = [
    path('login/', public(user_views.Login.as_view()), name='login'),
    path('logout/', auth_views.logout_then_login, name='logout'),
    path('register/', public(user_views.Register.as_view()), name='register'),
]
Ejemplo n.º 28
0
#
# This file is part of Plinth.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
"""
URLs for the plinth api for android app.
"""

from django.conf.urls import url
from stronghold.decorators import public

from plinth.modules.api.views import get_apps, get_access_info

urlpatterns = [
    url(r'^api/(?P<version>[0-9]+)/services/?$', public(get_apps)),
    url(r'^api/(?P<version>[0-9]+)/access-info/?$', public(get_access_info))
]
Ejemplo n.º 29
0
#
# This file is part of Plinth.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
"""
URLs for the Single Sign On module.
"""

from django.conf.urls import url


from .views import SSOLoginView, refresh
from stronghold.decorators import public

urlpatterns = [
    url(r'^accounts/sso/login/$', public(SSOLoginView.as_view()), name='sso-login'),
    url(r'^accounts/sso/refresh/$', refresh, name='sso-refresh'),
]
Ejemplo n.º 30
0
from . import views

urlpatterns = [
    re_path(r'^sys/users/$', views.UserList.as_view(), name='index'),
    re_path(r'^sys/users/create/$', views.UserCreate.as_view(), name='create'),
    re_path(r'^sys/users/(?P<slug>[\w.@+-]+)/edit/$',
            non_admin_view(views.UserUpdate.as_view()),
            name='edit'),
    re_path(r'^sys/users/(?P<slug>[\w.@+-]+)/delete/$',
            views.UserDelete.as_view(),
            name='delete'),
    re_path(r'^sys/users/(?P<slug>[\w.@+-]+)/change_password/$',
            non_admin_view(views.UserChangePassword.as_view()),
            name='change_password'),

    # Authnz is handled by SSO

    # XXX: Use axes authentication backend and middleware instead of
    # axes_dispatch after axes 5.x becomes available in Debian stable.
    re_path(r'^accounts/login/$',
            public(axes_dispatch(SSOLoginView.as_view())),
            name='login'),
    re_path(r'^accounts/logout/$', public(logout), name='logout'),
    re_path(r'^users/firstboot/$',
            public(views.FirstBootView.as_view()),
            name='firstboot'),
    re_path(r'accounts/login/locked/$',
            public(CaptchaLoginView.as_view()),
            name='locked_out'),
]
Ejemplo n.º 31
0
"""
Django URLconf file containing all urls
"""
from django.conf.urls import url
from django.views.generic import TemplateView

from captcha import views as cviews
from plinth.modules.sso.views import CaptchaLoginView
from stronghold.decorators import public

from . import views

urlpatterns = [
    url(r'^$', views.index, name='index'),
    url(r'^language-selection/$',
        public(views.LanguageSelectionView.as_view()),
        name='language-selection'),
    url(r'^apps/$',
        TemplateView.as_view(template_name='apps.html'),
        name='apps'),
    url(r'^sys/$', views.system_index, name='system'),

    # captcha urls are public
    url(r'^captcha/image/(?P<key>\w+)/$',
        public(cviews.captcha_image),
        name='captcha-image',
        kwargs={'scale': 1}),
    url(r'^captcha/image/(?P<key>\w+)@2/$',
        public(cviews.captcha_image),
        name='captcha-image-2x',
        kwargs={'scale': 2}),
Ejemplo n.º 32
0
from django.conf.urls import url
from django.views.generic import TemplateView

from captcha import views as cviews
from plinth.modules.sso.views import CaptchaLoginView
from stronghold.decorators import public

from . import views

urlpatterns = [
    url(r'^$', views.index, name='index'),
    url(r'^apps/$',
        TemplateView.as_view(template_name='apps.html'), name='apps'),
    url(r'^sys/$', views.system_index, name='system'),

    # captcha urls are public
    url(r'^captcha/image/(?P<key>\w+)/$',
        public(cviews.captcha_image), name='captcha-image',
        kwargs={'scale': 1}),
    url(r'^captcha/image/(?P<key>\w+)@2/$',
        public(cviews.captcha_image), name='captcha-image-2x',
        kwargs={'scale': 2}),
    url(r'^captcha/audio/(?P<key>\w+)/$',
        public(cviews.captcha_audio), name='captcha-audio'),
    url(r'^captcha/refresh/$',
        public(cviews.captcha_refresh), name='captcha-refresh'),

    # locked url from django-axes
    url(r'locked/$', public(CaptchaLoginView.as_view()), name='locked_out'),
]
Ejemplo n.º 33
0
from dashboard.views.events import CourseSingleEventDeleteView
from dashboard.views.events import CourseSingleEventListView
from dashboard.views.events import CourseSingleEventUpdateView
from dashboard.views.events import CourseSubmissionEventCreateView
from dashboard.views.events import CourseSubmissionEventDeleteView
from dashboard.views.events import CourseSubmissionEventListView
from dashboard.views.events import CourseSubmissionEventUpdateView
from dashboard.views.students import StudentDetailView
from dashboard.views.students import StudentsView
from dashboard.views.users import CustomLoginView
from dashboard.views.users import DashboardRedirectView
from django_site.permissions import course_access_url_wrapper

urlpatterns = [
    url(r'^$', DashboardRedirectView.as_view(), name='dashboard_redirect'),
    url(r'^login/', public(CustomLoginView.as_view()), name='login'),
    url(r'^logout/', LogoutView.as_view(), name='logout'),
    url(r'^courses/', CourseListView.as_view(), name='course_list'),
    url(
        r'^(?P<course_id>\d+)/',
        decorator_include(
            course_access_url_wrapper,
            [
                url(r'^course_dashboard/$',
                    CourseDashboardView.as_view(),
                    name='course_dashboard'),
                url(r'^assessment/$',
                    CourseAssessmentView.as_view(),
                    name='course_assessments'),
                url(r'^communication/$',
                    CourseCommunicationView.as_view(),
Ejemplo n.º 34
0
# SPDX-License-Identifier: AGPL-3.0-or-later
"""
URLs for the plinth api for android app.
"""

from django.conf.urls import url
from stronghold.decorators import public

from plinth.modules.api import views

urlpatterns = [
    url(r'^api/(?P<version>[0-9]+)/shortcuts/?$', public(views.shortcuts)),
    url(r'^api/(?P<version>[0-9]+)/access-info/?$', public(views.access_info)),
]
Ejemplo n.º 35
0
from django.conf import settings
from django.contrib import admin
from django.urls import include, path
from stronghold.decorators import public

import meme_creator.views

urlpatterns = [
    path('', public(meme_creator.views.Home.as_view()), name='home'),
    path('admin/', admin.site.urls),
    path('marketing/', include('apps.marketing.urls')),
    path('meme/', include('apps.meme.urls')),
    path('user/', include('apps.user.urls')),
]

if settings.DEBUG:
    import debug_toolbar

    urlpatterns = [
        path('__debug__/', include(debug_toolbar.urls)),
    ] + urlpatterns
Ejemplo n.º 36
0
# SPDX-License-Identifier: AGPL-3.0-or-later
"""
Django URLconf file containing all urls
"""
from captcha import views as cviews
from django.conf.urls import url
from stronghold.decorators import public

from plinth.modules.sso.views import CaptchaLoginView

from . import views

urlpatterns = [
    url(r'^$', views.index, name='index'),
    url(r'^language-selection/$',
        public(views.LanguageSelectionView.as_view()),
        name='language-selection'),
    url(r'^apps/$', views.AppsIndexView.as_view(), name='apps'),
    url(r'^sys/$', views.system_index, name='system'),

    # captcha urls are public
    url(r'^captcha/image/(?P<key>\w+)/$', public(cviews.captcha_image),
        name='captcha-image', kwargs={'scale': 1}),
    url(r'^captcha/image/(?P<key>\w+)@2/$', public(cviews.captcha_image),
        name='captcha-image-2x', kwargs={'scale': 2}),
    url(r'^captcha/audio/(?P<key>\w+)/$', public(cviews.captcha_audio),
        name='captcha-audio'),
    url(r'^captcha/refresh/$', public(cviews.captcha_refresh),
        name='captcha-refresh'),

    # locked url from django-axes
Ejemplo n.º 37
0
URLs for the Users module
"""

from django.conf.urls import url
from django.contrib.auth import views as auth_views
from django.urls import reverse_lazy
from stronghold.decorators import public

from plinth.utils import non_admin_view
from . import views


urlpatterns = [
    url(r'^sys/users/$', views.UserList.as_view(), name='index'),
    url(r'^sys/users/create/$', views.UserCreate.as_view(), name='create'),
    url(r'^sys/users/(?P<slug>[\w.@+-]+)/edit/$',
        non_admin_view(views.UserUpdate.as_view()), name='edit'),
    url(r'^sys/users/(?P<slug>[\w.@+-]+)/delete/$', views.UserDelete.as_view(),
        name='delete'),
    url(r'^sys/users/(?P<slug>[\w.@+-]+)/change_password/$',
        non_admin_view(views.UserChangePassword.as_view()),
        name='change_password'),
    # Add Django's login/logout urls
    url(r'^accounts/login/$', public(auth_views.login),
        {'template_name': 'login.html'}, name='login'),
    url(r'^accounts/logout/$', public(auth_views.logout),
        {'next_page': reverse_lazy('index')}, name='logout'),
    url(r'^users/firstboot/$', public(views.FirstBootView.as_view()),
        name='firstboot'),
]
Ejemplo n.º 38
0
from django.conf import settings
from django.contrib import admin
from django.urls import include, path
from stronghold.decorators import public

import rss_scraper.views

urlpatterns = [
    path("", public(rss_scraper.views.Home.as_view()), name="home"),
    path("admin/", admin.site.urls),
    path("feeds/", include("apps.feeds.urls")),
    path("notifications/", include("apps.notifications.urls")),
    path("user/", include("apps.user.urls")),
]
Ejemplo n.º 39
0
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

"""
URLs for the First Boot module
"""

from django.conf.urls import url
from stronghold.decorators import public

from .views import State0View, State1View, state10


urlpatterns = [
    # Take care of the firstboot middleware when changing URLs
    url(r'^firstboot/$', public(State0View.as_view()), name='index'),
    url(r'^firstboot/state0/$', public(State0View.as_view()), name='state0'),
    url(r'^firstboot/state1/$', public(State1View.as_view()), name='state1'),
    url(r'^firstboot/state10/$', state10, name='state10'),
]
Ejemplo n.º 40
0
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
"""
URLs for the Single Sign On module.
"""

from django.conf.urls import url

from .views import SSOLoginView, refresh
from stronghold.decorators import public
from plinth.utils import non_admin_view

urlpatterns = [
    url(r'^accounts/sso/login/$',
        public(SSOLoginView.as_view()), name='sso-login'),
    url(r'^accounts/sso/refresh/$', non_admin_view(refresh),
        name='sso-refresh'),
]