]> git.parisson.com Git - teleforma.git/commitdiff
add admin "login as" button and view
authoryomguy <yomguy@parisson.com>
Fri, 20 Apr 2012 12:46:15 +0000 (14:46 +0200)
committeryomguy <yomguy@parisson.com>
Fri, 20 Apr 2012 12:46:15 +0000 (14:46 +0200)
teleforma/locale/fr/LC_MESSAGES/django.mo
teleforma/locale/fr/LC_MESSAGES/django.po
teleforma/templates/telemeta/profile_detail.html
teleforma/urls.py
teleforma/views.py

index 8fd358346fd46f1043a95df210570a6006186cb4..d21bea94a79ab8b80b04cdfb0ca85db9299add49 100644 (file)
Binary files a/teleforma/locale/fr/LC_MESSAGES/django.mo and b/teleforma/locale/fr/LC_MESSAGES/django.mo differ
index 866b9b7f84ea9546d9b13c925e51a215d8e061f2..d79c6a7cf39aec3bab159ba97d990dcc87604c56 100644 (file)
@@ -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 <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\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"
index 314b058215ba9cee3f76673aa2c98f030103a6fe..be371ffbf53aafc0633e194d893ade1ea50c2ed7 100644 (file)
@@ -88,6 +88,7 @@
 
   </div>
 
+<a href="{% url teleforma-user-login usr.id %}" class="component_icon button icon_login">{% trans "Login as" %}</a>
 
 </div>
 </div>
index 559ab0d25f044f2f71e5c00ce99b49e399855ce6..2a61147904cb7f864bb95654cec7e2b674853ff9 100644 (file)
@@ -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<id>.*)/export/$', user_export.by_training, name="teleforma-training-users-export"),
+    url(r'^users/(?P<id>.*)/login/$', UserLoginView.as_view(), name="teleforma-user-login"),
 
 # CSS+Images (FIXME: for developement only)
     url(r'^teleforma/css/(?P<path>.*)$', 'django.views.static.serve',
index 6935785c36d550233ab9c436e199ee377f7ae1cf..4a126fed10e0eb3b4fdee15cc43d796fba722532 100755 (executable)
@@ -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):