changeset 4095:1a4831ea2ae3

packages.do_addrevision: fix of MoinMoinBugs/PackagesAddRevision (addrevision of a package fails with Accessdenied if the user listed in MOIN_PACKAGE has no write rights on a wiki)
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sun, 14 Sep 2008 14:54:54 +0200
parents 1f6f713c526c
children 30547727b678
files MoinMoin/packages.py
diffstat 1 files changed, 6 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/packages.py	Sat Sep 13 15:46:51 2008 +0200
+++ b/MoinMoin/packages.py	Sun Sep 14 14:54:54 2008 +0200
@@ -292,21 +292,17 @@
         @param comment:  comment related to this revision (optional)
         @param trivial:  boolean, if it is a trivial edit
         """
+        _ = self.request.getText
+        trivial = str2boolean(trivial)
         if self.request.user.may.write(pagename):
-            _ = self.request.getText
-            trivial = str2boolean(trivial)
-            uid = user.getUserId(self.request, author)
-            theuser = user.User(self.request, uid)
-            save_user = self.request.user
-            self.request.user = theuser
-            page = PageEditor(self.request, pagename, do_editor_backup=0, uid_override=author)
+            page = PageEditor(self.request, pagename, do_editor_backup=0)
             try:
                 page.saveText(self.extract_file(filename).decode("utf-8"), 0, trivial=trivial, comment=comment)
-                self.msg += u"%(pagename)s added \n" % {"pagename": pagename}
             except PageEditor.Unchanged:
                 pass
-            self.request.user = save_user
-            page.clean_acl_cache()
+            else:
+                self.msg += u"%(pagename)s added \n" % {"pagename": pagename}
+                page.clean_acl_cache()
         else:
             self.msg += u"action add revision: not enough rights - nothing done \n"