------------------------------------------------------------
revno: 1293
committer: Mark Sapiro <msap...@value.net>
branch nick: 2.1
timestamp: Sat 2011-04-23 17:49:15 -0700
message:
  Added a logout link to the admindb interface and made both admin and
  admindb logout effective for a site admin cookie if allowed.
  Bug #769318.
modified:
  Mailman/Cgi/admin.py
  Mailman/Cgi/admindb.py
  NEWS


--
lp:mailman/2.1
https://code.launchpad.net/~mailman-coders/mailman/2.1

Your team Mailman Checkins is subscribed to branch lp:mailman/2.1.
To unsubscribe from this branch go to 
https://code.launchpad.net/~mailman-coders/mailman/2.1/+edit-subscription
=== modified file 'Mailman/Cgi/admin.py'
--- Mailman/Cgi/admin.py	2011-04-15 17:51:20 +0000
+++ Mailman/Cgi/admin.py	2011-04-24 00:49:15 +0000
@@ -107,6 +107,9 @@
 
     # Is this a log-out request?
     if category == 'logout':
+        # site-wide admin should also be able to logout.
+        if mlist.AuthContextInfo(mm_cfg.AuthSiteAdmin)[0] == 'site':
+            print mlist.ZapCookie(mm_cfg.AuthSiteAdmin)
         print mlist.ZapCookie(mm_cfg.AuthListAdmin)
         Auth.loginpage(mlist, 'admin', frontpage=1)
         return

=== modified file 'Mailman/Cgi/admindb.py'
--- Mailman/Cgi/admindb.py	2010-09-03 19:30:34 +0000
+++ Mailman/Cgi/admindb.py	2011-04-24 00:49:15 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 1998-2010 by the Free Software Foundation, Inc.
+# Copyright (C) 1998-2011 by the Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
@@ -112,6 +112,19 @@
         Auth.loginpage(mlist, 'admindb', msg=msg)
         return
 
+    # Add logout function. Note that admindb may be accessed with
+    # site-wide admin, moderator and list admin privileges.
+    # site admin may have site or admin cookie. (or both?)
+    # See if this is a logout request
+    if len(parts) >= 2 and parts[1] == 'logout':
+        if mlist.AuthContextInfo(mm_cfg.AuthSiteAdmin)[0] == 'site':
+            print mlist.ZapCookie(mm_cfg.AuthSiteAdmin)
+        if mlist.AuthContextInfo(mm_cfg.AuthListModerator)[0]:
+            print mlist.ZapCookie(mm_cfg.AuthListModerator)
+        print mlist.ZapCookie(mm_cfg.AuthListAdmin)
+        Auth.loginpage(mlist, 'admindb', frontpage=1)
+        return
+
     # Set up the results document
     doc = Document()
     doc.set_language(mlist.preferred_language)
@@ -167,20 +180,24 @@
             process_form(mlist, doc, cgidata)
         # Now print the results and we're done.  Short circuit for when there
         # are no pending requests, but be sure to save the results!
+        admindburl = mlist.GetScriptURL('admindb', absolute=1)
         if not mlist.NumRequestsPending():
             title = _('%(realname)s Administrative Database')
             doc.SetTitle(title)
             doc.AddItem(Header(2, title))
             doc.AddItem(_('There are no pending requests.'))
             doc.AddItem(' ')
-            doc.AddItem(Link(mlist.GetScriptURL('admindb', absolute=1),
+            doc.AddItem(Link(admindburl,
                              _('Click here to reload this page.')))
+            # Put 'Logout' link before the footer
+            doc.AddItem(Link('%s/logout' % admindburl,
+                '<div align="right"><font size="+2"><b>%s</b></font></div>' %
+                _('Logout')))
             doc.AddItem(mlist.GetMailmanFooter())
             print doc.Format()
             mlist.Save()
             return
 
-        admindburl = mlist.GetScriptURL('admindb', absolute=1)
         form = Form(admindburl)
         # Add the instructions template
         if details == 'instructions':
@@ -249,6 +266,10 @@
                     _('Discard all messages marked <em>Defer</em>')
                     ))
             form.AddItem(Center(SubmitButton('submit', _('Submit All Data'))))
+        # Put 'Logout' link before the footer
+        doc.AddItem(Link('%s/logout' % admindburl,
+            '<div align="right"><font size="+2"><b>%s</b></font></div>' %
+            _('Logout')))
         doc.AddItem(mlist.GetMailmanFooter())
         print doc.Format()
         # Commit all changes

=== modified file 'NEWS'
--- NEWS	2011-04-23 22:28:42 +0000
+++ NEWS	2011-04-24 00:49:15 +0000
@@ -38,6 +38,10 @@
 
   Bug Fixes and other patches
 
+    - Added a logout link to the admindb interface and made both admin and
+      admindb logout effective for a site admin cookie if allowed.
+      Bug #769318.
+
     - Replaced the old Mailman logos and icon that install to Mailman's icons
       directory with the new ones.  If you copy these elsewhere on your
       server, please copy these new ones.

_______________________________________________
Mailman-checkins mailing list
Mailman-checkins@python.org
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org

Reply via email to