1.1 --- a/macros/VoteRecorder.py Sun Mar 02 18:31:45 2008 +0100
1.2 +++ b/macros/VoteRecorder.py Mon Mar 03 00:47:50 2008 +0100
1.3 @@ -11,6 +11,7 @@
1.4
1.5 from MoinMoin.util import filesys, lock
1.6 from MoinMoin import wikiutil
1.7 +import MoinMoin.user
1.8 import os
1.9 try:
1.10 import cPickle as pickle
1.11 @@ -88,17 +89,24 @@
1.12 output.append(fmt.sysmsg(on=0))
1.13 return ''.join(output)
1.14
1.15 - # Show a message if the user is not logged in.
1.16 + # Check for extra arguments.
1.17 + # NOTE: This is only adequate protection if an ACL stops untrusted users
1.18 + # NOTE: from editing the page. This should actually query the ACL in order
1.19 + # NOTE: to prevent such exploits.
1.20 +
1.21 + public = "public" in args[1:]
1.22
1.23 # Get the user, if known.
1.24 + # Show a message if the user is not logged in and the poll is not public.
1.25
1.26 - if not request.user.valid:
1.27 + if not public and not request.user.valid:
1.28 output.append(fmt.emphasis(on=1))
1.29 output.append(fmt.text("Please log in to vote!"))
1.30 output.append(fmt.emphasis(on=0))
1.31 return ''.join(output)
1.32
1.33 - username = request.user.name
1.34 + username = MoinMoin.user.getUserIdentification(request)
1.35 + #username = request.user.valid and request.user.name or request.user.host()
1.36 votes = get_all_votes(page, poll_name)
1.37
1.38 # Handle any vote.