changeset 1916:d41e6ef31c0e

PageEditor.copyPage: write access checked on old page instead of the copied one
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Tue, 27 Mar 2007 19:57:03 +0200
parents ed85c389031d
children 9a25a7ae3514
files MoinMoin/PageEditor.py
diffstat 1 files changed, 11 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/PageEditor.py	Mon Mar 26 18:52:21 2007 +0200
+++ b/MoinMoin/PageEditor.py	Tue Mar 27 19:57:03 2007 +0200
@@ -473,7 +473,7 @@
         """
         User clicked on Cancel button. If edit locking is active,
         delete the current lock file.
-        
+
         @param newtext: the edited text (which has been cancelled)
         @param rev: not used!?
         """
@@ -489,7 +489,7 @@
     def copyPage(self, newpagename, comment=None):
         """
         Copy the current version of the page (keeping the backups, logs and attachments).
-        
+
         @param comment: Comment given by user
         @rtype: unicode
         @return: success flag, error message
@@ -502,7 +502,7 @@
 
         if not self.request.user.may.write(newpagename):
             return False, _('You are not allowed to copy this page!')
-    
+
         newpage = PageEditor(request, newpagename)
 
         pageexists_error = _("""'''A page with the name {{{'%s'}}} already exists.'''
@@ -525,8 +525,9 @@
             self.error = None
             if not comment:
                 comment = u"## page was copied from %s" % self.page_name
-            if request.user.may.write(newpagename):
-                # If current user has write access
+            if request.user.may.write(self.page_name):
+                # ToDo: check difference to request.user.may.write(newpagename)
+                # If current user has write access to the old page
                 # Save page text with a comment about the old name
                 savetext = u"## page was copied from %s\n%s" % (self.page_name, savetext)
                 newpage.saveText(savetext, 0, comment=comment, index=0, extra=self.page_name, action='SAVE')
@@ -555,7 +556,7 @@
         """
         Rename the current version of the page (making a backup before deletion
         and keeping the backups, logs and attachments).
-        
+
         @param comment: Comment given by user
         @rtype: unicode
         @return: success flag, error message
@@ -633,7 +634,7 @@
         """
         Delete the current version of the page (making a backup before deletion
         and keeping the backups, logs and attachments).
-        
+
         @param comment: Comment given by user
         @rtype: unicode
         @return: success flag, error message
@@ -835,7 +836,7 @@
         You should normalize any text you enter into a page, for
         example, when getting new text from the editor, or when setting
         new text manually.
-                
+
         @param text: text to normalize (unicode)
         @keyword stripspaces: if 1, strip spaces from text
         @rtype: unicode
@@ -928,7 +929,7 @@
 
     def _write_file(self, text, action='SAVE', comment=u'', extra=u'', deleted=False):
         """ Write the text to the page file (and make a backup of old page).
-        
+
         @param text: text to save for this page
         @param deleted: if True, then don't write page content (used by deletePage)
         @rtype: int
@@ -1257,7 +1258,7 @@
     def release(self, force=0):
         """ 
         Release lock, if we own it.
-        
+
         @param force: if 1, unconditionally release the lock.
         """
         if self.locktype: