Merge lp:~tkikuchi/mailman/logout-enforcement into lp:mailman/2.1

Proposed by Tokio Kikuchi
Status: Merged
Approved by: Mark Sapiro
Approved revision: 1292
Merge reported by: Mark Sapiro
Merged at revision: not available
Proposed branch: lp:~tkikuchi/mailman/logout-enforcement
Merge into: lp:mailman/2.1
Diff against target: 73 lines (+24/-2)
2 files modified
Mailman/Cgi/admin.py (+3/-0)
Mailman/Cgi/admindb.py (+21/-2)
To merge this branch: bzr merge lp:~tkikuchi/mailman/logout-enforcement
Reviewer Review Type Date Requested Status
Mark Sapiro code Approve
Review via email: mp+58778@code.launchpad.net

Description of the change

Current 2.1 web interface for admindb has no function of 'logout'. Also, if the site set ALLOW_SITE_ADMIN_COOKIES Yes, the site-wide administrator cannot logout with the logout link in admin interface. This patch should fix the above inconvenience.

  1. Add Logout link in admindb pages (just before the mailman footer)
  2. Logout should be cared for site-wide admin and moderator.

To post a comment you must log in.
Revision history for this message
Mark Sapiro (msapiro) wrote :

Thank you Tokio. I like the changes very much except for the appearance of the admindb 'Logout' link itself. I made it bigger and bold like the one on the admin pages and moved it to the right side of the page to make it stand out more. I will merge these changes into the base.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Mailman/Cgi/admin.py'
2--- Mailman/Cgi/admin.py 2011-04-15 17:51:20 +0000
3+++ Mailman/Cgi/admin.py 2011-04-22 02:32:25 +0000
4@@ -107,6 +107,9 @@
5
6 # Is this a log-out request?
7 if category == 'logout':
8+ # site-wide admin should also be able to logout.
9+ if mlist.AuthContextInfo(mm_cfg.AuthSiteAdmin)[0] == 'site':
10+ print mlist.ZapCookie(mm_cfg.AuthSiteAdmin)
11 print mlist.ZapCookie(mm_cfg.AuthListAdmin)
12 Auth.loginpage(mlist, 'admin', frontpage=1)
13 return
14
15=== modified file 'Mailman/Cgi/admindb.py'
16--- Mailman/Cgi/admindb.py 2010-09-03 19:30:34 +0000
17+++ Mailman/Cgi/admindb.py 2011-04-22 02:32:25 +0000
18@@ -112,6 +112,19 @@
19 Auth.loginpage(mlist, 'admindb', msg=msg)
20 return
21
22+ # Add logout function. Note that admindb may be accessed with
23+ # site-wide admin, moderator and list admin privileges.
24+ # site admin may have site or admin cookie. (or both?)
25+ # See if this is a logout request
26+ if len(parts) >= 2 and parts[1] == 'logout':
27+ if mlist.AuthContextInfo(mm_cfg.AuthSiteAdmin)[0] == 'site':
28+ print mlist.ZapCookie(mm_cfg.AuthSiteAdmin)
29+ if mlist.AuthContextInfo(mm_cfg.AuthListModerator)[0]:
30+ print mlist.ZapCookie(mm_cfg.AuthListModerator)
31+ print mlist.ZapCookie(mm_cfg.AuthListAdmin)
32+ Auth.loginpage(mlist, 'admindb', frontpage=1)
33+ return
34+
35 # Set up the results document
36 doc = Document()
37 doc.set_language(mlist.preferred_language)
38@@ -167,20 +180,23 @@
39 process_form(mlist, doc, cgidata)
40 # Now print the results and we're done. Short circuit for when there
41 # are no pending requests, but be sure to save the results!
42+ admindburl = mlist.GetScriptURL('admindb', absolute=1)
43 if not mlist.NumRequestsPending():
44 title = _('%(realname)s Administrative Database')
45 doc.SetTitle(title)
46 doc.AddItem(Header(2, title))
47 doc.AddItem(_('There are no pending requests.'))
48 doc.AddItem(' ')
49- doc.AddItem(Link(mlist.GetScriptURL('admindb', absolute=1),
50+ doc.AddItem(Link(admindburl,
51 _('Click here to reload this page.')))
52+ # Put 'Logout' link before the footer
53+ doc.AddItem('<br />\n')
54+ doc.AddItem(Link('%s/logout' % admindburl, _('Logout')))
55 doc.AddItem(mlist.GetMailmanFooter())
56 print doc.Format()
57 mlist.Save()
58 return
59
60- admindburl = mlist.GetScriptURL('admindb', absolute=1)
61 form = Form(admindburl)
62 # Add the instructions template
63 if details == 'instructions':
64@@ -249,6 +265,9 @@
65 _('Discard all messages marked <em>Defer</em>')
66 ))
67 form.AddItem(Center(SubmitButton('submit', _('Submit All Data'))))
68+ # Put 'Logout' link before the footer
69+ doc.AddItem('<br />\n')
70+ doc.AddItem(Link('%s/logout' % admindburl, _('Logout')))
71 doc.AddItem(mlist.GetMailmanFooter())
72 print doc.Format()
73 # Commit all changes