changeset 3473:59a4005672d3

theme.__init__: action enabled dependent of rights
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sat, 05 Apr 2008 11:48:47 +0200
parents 4abf8492a665
children b485c2b6b2b9 e818988b5b91
files MoinMoin/theme/__init__.py
diffstat 1 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/theme/__init__.py	Sat Apr 05 11:19:45 2008 +0200
+++ b/MoinMoin/theme/__init__.py	Sat Apr 05 11:48:47 2008 +0200
@@ -973,9 +973,24 @@
                 data['action'] = 'show'
                 data['disabled'] = disabled
 
+            # SubscribeUser action enabled only if user has admin rights
+            if action == 'SubscribeUser' and not request.user.may.admin(page.page_name):
+                data['action'] = 'show'
+                data['disabled'] = disabled
+
+            # PackagePages action only if user has write rights
+            if action == 'PackagePages' and not request.user.may.write(page.page_name):
+                data['action'] = 'show'
+                data['disabled'] = disabled
+
+            # Despam action enabled only for superusers
+            if action == 'Despam' and not request.user.isSuperUser():
+                data['action'] = 'show'
+                data['disabled'] = disabled
+
             # Special menu items. Without javascript, executing will
             # just return to the page.
-            elif action.startswith('__'):
+            if action.startswith('__'):
                 data['action'] = 'show'
 
             # Actions which are not available for this wiki, user or page