changeset 3521:c9f5e4f9a76e

action bookmark, subscribe, unsubscribe, userprefs: check for valid.user
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sat, 26 Apr 2008 11:12:30 +0200
parents fa0ee02c9c39
children 5ca3fd52a265
files MoinMoin/action/bookmark.py MoinMoin/action/subscribe.py MoinMoin/action/unsubscribe.py MoinMoin/action/userprefs.py
diffstat 4 files changed, 23 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/action/bookmark.py	Sat Apr 26 10:39:25 2008 +0200
+++ b/MoinMoin/action/bookmark.py	Sat Apr 26 11:12:30 2008 +0200
@@ -9,10 +9,16 @@
 import time
 
 from MoinMoin import wikiutil
-
+from MoinMoin.Page import Page
 
 def execute(pagename, request):
     """ set bookmarks (in time) for RecentChanges or delete them """
+    _ = request.getText
+    actname = __name__.split('.')[-1]
+    if not request.user.valid:
+        request.theme.add_msg(_("You must login to use this action: %(action)s.") % {"action": actname}, "error")
+        return Page(request, pagename).send_page()
+
     timestamp = request.form.get('time', [None])[0]
     if timestamp is not None:
         if timestamp == 'del':
--- a/MoinMoin/action/subscribe.py	Sat Apr 26 10:39:25 2008 +0200
+++ b/MoinMoin/action/subscribe.py	Sat Apr 26 11:12:30 2008 +0200
@@ -11,6 +11,11 @@
 def execute(pagename, request):
     """ Subscribe the user to pagename """
     _ = request.getText
+    actname = __name__.split('.')[-1]
+    if not request.user.valid:
+        request.theme.add_msg(_("You must login to use this action: %(action)s.") % {"action": actname}, "error")
+        return Page(request, pagename).send_page()
+
     cfg = request.cfg
 
     if not request.user.may.read(pagename):
--- a/MoinMoin/action/unsubscribe.py	Sat Apr 26 10:39:25 2008 +0200
+++ b/MoinMoin/action/unsubscribe.py	Sat Apr 26 11:12:30 2008 +0200
@@ -11,6 +11,11 @@
 def execute(pagename, request):
     """ Unsubscribe the user from pagename """
     _ = request.getText
+    actname = __name__.split('.')[-1]
+    if not request.user.valid:
+        request.theme.add_msg(_("You must login to use this action: %(action)s.") % {"action": actname}, "error")
+        return Page(request, pagename).send_page()
+
     msg = None
 
     if request.user.isSubscribedTo([pagename]):
--- a/MoinMoin/action/userprefs.py	Sat Apr 26 10:39:25 2008 +0200
+++ b/MoinMoin/action/userprefs.py	Sat Apr 26 11:12:30 2008 +0200
@@ -7,7 +7,7 @@
     @license: GNU GPL, see COPYING for details.
 """
 
-from MoinMoin import wikiutil
+from MoinMoin import Page, wikiutil
 from MoinMoin.widget import html
 
 def _handle_submission(request):
@@ -87,6 +87,11 @@
 
 def execute(pagename, request):
     _ = request.getText
+    actname = __name__.split('.')[-1]
+    if not request.user.valid:
+        request.theme.add_msg(_("You must login to use this action: %(action)s.") % {"action": actname}, "error")
+        return Page.Page(request, pagename).send_page()
+
     text, title, msg_class, msg = _create_page(request)
     if title:
         # XXX: we would like to make "Settings" here a link back