From: yomguy Date: Fri, 20 Apr 2012 12:46:15 +0000 (+0200) Subject: add admin "login as" button and view X-Git-Tag: 0.3~17 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=8fbbdf5fbfe3d1b68f260f3d39eae0788ff57772;p=teleforma.git add admin "login as" button and view --- diff --git a/teleforma/locale/fr/LC_MESSAGES/django.mo b/teleforma/locale/fr/LC_MESSAGES/django.mo index 8fd35834..d21bea94 100644 Binary files a/teleforma/locale/fr/LC_MESSAGES/django.mo and b/teleforma/locale/fr/LC_MESSAGES/django.mo differ diff --git a/teleforma/locale/fr/LC_MESSAGES/django.po b/teleforma/locale/fr/LC_MESSAGES/django.po index 866b9b7f..d79c6a7c 100644 --- a/teleforma/locale/fr/LC_MESSAGES/django.po +++ b/teleforma/locale/fr/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-04-19 21:48+0200\n" +"POT-Creation-Date: 2012-04-20 14:46+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -341,7 +341,7 @@ msgstr "Messages" #: templates/postman/base_write.html:20 #: templates/teleforma/course_conference.html:57 #: templates/teleforma/course_detail.html:69 -#: templates/teleforma/course_document.html:45 +#: templates/teleforma/course_document.html:87 #: templates/teleforma/course_media.html:84 #: templates/teleforma/courses.html:102 msgid "Send" @@ -492,7 +492,7 @@ msgstr "Supports écrits" #: templates/teleforma/course.html:18 templates/teleforma/course.html.py:34 #: templates/teleforma/course_conference.html:33 -#: templates/teleforma/course_document.html:21 +#: templates/teleforma/course_document.html:68 #: templates/teleforma/inc/document_list.html:11 #: templates/teleforma/inc/media_list.html:11 templates/telemeta/lists.html:69 #: templates/telemeta/search_criteria.html:97 @@ -522,14 +522,12 @@ msgstr "Conférences" #: templates/teleforma/course.html:51 #: templates/teleforma/course_conference.html:34 -#: templates/teleforma/course_document.html:22 #: templates/teleforma/inc/conference_list.html:13 msgid "Session" msgstr "Session" #: templates/teleforma/course.html:52 #: templates/teleforma/course_conference.html:35 -#: templates/teleforma/course_document.html:23 #: templates/teleforma/course_media.html:51 #: templates/teleforma/inc/conference_list.html:14 #: templates/telemeta/inc/user_list.html:51 @@ -537,23 +535,20 @@ msgid "Professor" msgstr "Professeur" #: templates/teleforma/course_conference.html:36 -#: templates/teleforma/course_document.html:24 msgid "Begin" -msgstr "" +msgstr "Début" #: templates/teleforma/course_conference.html:37 -#: templates/teleforma/course_document.html:25 msgid "End" -msgstr "" +msgstr "Fin" #: templates/teleforma/course_conference.html:38 -#: templates/teleforma/course_document.html:26 msgid "Live" -msgstr "" +msgstr "En direct" #: templates/teleforma/course_conference.html:50 #: templates/teleforma/course_detail.html:62 -#: templates/teleforma/course_document.html:38 +#: templates/teleforma/course_document.html:80 #: templates/teleforma/course_media.html:77 msgid "Local tweeter" msgstr "Tweeter local" @@ -604,7 +599,7 @@ msgstr "" #: templates/teleforma/inc/conference_list.html:12 msgid "Room" -msgstr "" +msgstr "Salle" #: templates/teleforma/inc/conference_list.html:16 msgid "Streaming" @@ -665,9 +660,8 @@ msgid "Admin" msgstr "" #: templates/telemeta/base.html:106 -#, fuzzy msgid "Profile" -msgstr "profil" +msgstr "Profil" #: templates/telemeta/base.html:108 msgid "Lists" @@ -805,6 +799,10 @@ msgstr "" msgid "Apply" msgstr "" +#: templates/telemeta/profile_detail.html:91 +msgid "Login as" +msgstr "Se connecter en tant que" + #: templates/telemeta/search_criteria.html:5 #: templates/telemeta/search_criteria.html:76 msgid "Advanced Search" diff --git a/teleforma/templates/telemeta/profile_detail.html b/teleforma/templates/telemeta/profile_detail.html index 314b0582..be371ffb 100644 --- a/teleforma/templates/telemeta/profile_detail.html +++ b/teleforma/templates/telemeta/profile_detail.html @@ -88,6 +88,7 @@ + diff --git a/teleforma/urls.py b/teleforma/urls.py index 559ab0d2..2a611479 100644 --- a/teleforma/urls.py +++ b/teleforma/urls.py @@ -64,6 +64,7 @@ urlpatterns = patterns('', url(r'^users/by_training/(\w+)/$', UsersTrainingView.as_view(), name="teleforma-training-users"), url(r'^users/all/export/$', user_export.all, name="teleforma-users-xls-export"), url(r'^users/by_training/(?P.*)/export/$', user_export.by_training, name="teleforma-training-users-export"), + url(r'^users/(?P.*)/login/$', UserLoginView.as_view(), name="teleforma-user-login"), # CSS+Images (FIXME: for developement only) url(r'^teleforma/css/(?P.*)$', 'django.views.static.serve', diff --git a/teleforma/views.py b/teleforma/views.py index 6935785c..4a126fed 100755 --- a/teleforma/views.py +++ b/teleforma/views.py @@ -5,7 +5,7 @@ import mimetypes from jsonrpc import jsonrpc_method from django.utils.decorators import method_decorator -from django.contrib.auth import authenticate, login +from django.contrib.auth import authenticate, login, get_backends from django.template import RequestContext, loader from django import template from django.http import HttpResponse, HttpResponseRedirect @@ -229,6 +229,20 @@ class UsersView(ListView): return super(UsersView, self).dispatch(*args, **kwargs) +class UserLoginView(View): + + def get(self, request, id): + user = User.objects.get(id=id) + backend = get_backends()[0] + user.backend = "%s.%s" % (backend.__module__, backend.__class__.__name__) + login(self.request, user) + return redirect('teleforma-desk') + + @method_decorator(permission_required('is_superuser')) + def dispatch(self, *args, **kwargs): + return super(UserLoginView, self).dispatch(*args, **kwargs) + + class UsersTrainingView(UsersView): def get_queryset(self):