def connector(request): connector_view = ElfinderConnectorView.as_view() log.debug(request.user.is_superuser) if request.user.is_superuser: response = connector_view(request, optionset="admin", start_path="default") elif request.user.is_staff: response = connector_view(request, optionset="staff", start_path="default") elif "trainer" in request.user.groups.all(): response = connector_view(request, optionset="trainer", start_path="default") elif request.user.is_authenticated(): group = request.user.groups.all()[0].name response = connector_view(request, optionset=group, start_path="default") else: response = connector_view(request, optionset="anon", start_path="default") return response
"""elfinder URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.8/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') Including another URLconf 1. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ from django.conf.urls import include, url from django.contrib.admin.views.decorators import staff_member_required from elfinder.views import ElfinderConnectorView urlpatterns = [ url(r'^yawd-connector/(?P<optionset>.+)/(?P<start_path>.+)/$', ElfinderConnectorView.as_view(), name='yawdElfinderConnectorView'), ]
from django.conf.urls import patterns, url from django.contrib.admin.views.decorators import staff_member_required from elfinder.views import ElfinderConnectorView from elfinder.view import roles urlpatterns = patterns( url(r'^yawd-connector/(?P<optionset>.+)/(?P<start_path>.+)/(?P<show_file>.+)/$', staff_member_required(ElfinderConnectorView.as_view()), name='yawdElfinderConnectorView'), url(r'^roles/(?P<optionset>.+)/(?P<start_path>.+)/(?P<show_file>.+)/$', ElfinderConnectorView.as_view(), name='ElfinderConnector'), url(r'^list/$', roles.role_management) )
"""elfinder URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.8/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') Including another URLconf 1. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ from django.conf.urls import include, url from django.contrib.admin.views.decorators import staff_member_required from elfinder.views import ElfinderConnectorView urlpatterns = [ url(r'^yawd-connector/(?P<optionset>.+)/(?P<start_path>.+)/$',staff_member_required(ElfinderConnectorView.as_view()),name='yawdElfinderConnectorView'), ]