comparison MoinMoin/PageEditor.py @ 6066:68092d872ecc

add page name to abuse log
author 'Karl O. Pinc' <kop@meme.com>
date Thu, 04 Sep 2014 14:09:28 -0500
parents 17ccba0ae187
children 751214fa01d7
comparison
equal deleted inserted replaced
6065:bbbfb024a967 6066:68092d872ecc
167 from MoinMoin.formatter.text_html import Formatter 167 from MoinMoin.formatter.text_html import Formatter
168 request.formatter = Formatter(request, store_pagelinks=1) 168 request.formatter = Formatter(request, store_pagelinks=1)
169 169
170 # check edit permissions 170 # check edit permissions
171 if not request.user.may.write(self.page_name): 171 if not request.user.may.write(self.page_name):
172 log_attempt('edit: edit', False, request) 172 log_attempt('edit: edit', False, request, name=self.page_name)
173 msg = _('You are not allowed to edit this page.') 173 msg = _('You are not allowed to edit this page.')
174 elif not self.isWritable(): 174 elif not self.isWritable():
175 log_attempt('edit: immutable', False, request) 175 log_attempt('edit: immutable', False, request, name=self.page_name)
176 msg = _('Page is immutable!') 176 msg = _('Page is immutable!')
177 elif self.rev: 177 elif self.rev:
178 # Trying to edit an old version, this is not possible via 178 # Trying to edit an old version, this is not possible via
179 # the web interface, but catch it just in case... 179 # the web interface, but catch it just in case...
180 msg = _('Cannot edit old revisions!') 180 msg = _('Cannot edit old revisions!')
552 552
553 if not newpagename: 553 if not newpagename:
554 return False, _("You can't copy to an empty pagename.") 554 return False, _("You can't copy to an empty pagename.")
555 555
556 if not self.request.user.may.write(newpagename): 556 if not self.request.user.may.write(newpagename):
557 log_attempt('edit: copy', False, request) 557 log_attempt('edit: copy', False, request, name=self.page_name)
558 return False, _('You are not allowed to copy this page!') 558 return False, _('You are not allowed to copy this page!')
559 559
560 newpage = PageEditor(request, newpagename) 560 newpage = PageEditor(request, newpagename)
561 561
562 pageexists_error = _("""'''A page with the name {{{'%s'}}} already exists.''' 562 pageexists_error = _("""'''A page with the name {{{'%s'}}} already exists.'''
605 request = self.request 605 request = self.request
606 _ = self._ 606 _ = self._
607 607
608 if not (request.user.may.delete(self.page_name) 608 if not (request.user.may.delete(self.page_name)
609 and request.user.may.write(newpagename)): 609 and request.user.may.write(newpagename)):
610 log_attempt('edit: rename', False, request) 610 log_attempt('edit: rename', False, request, name=self.page_name)
611 msg = _('You are not allowed to rename this page!') 611 msg = _('You are not allowed to rename this page!')
612 raise self.AccessDenied(msg) 612 raise self.AccessDenied(msg)
613 613
614 if not newpagename: 614 if not newpagename:
615 return False, _("You can't rename to an empty pagename.") 615 return False, _("You can't rename to an empty pagename.")
713 request = self.request 713 request = self.request
714 _ = self._ 714 _ = self._
715 success = True 715 success = True
716 if not (request.user.may.write(self.page_name) 716 if not (request.user.may.write(self.page_name)
717 and request.user.may.delete(self.page_name)): 717 and request.user.may.delete(self.page_name)):
718 log_attempt('edit: delete', False, request) 718 log_attempt('edit: delete', False, request, name=self.page_name)
719 msg = _('You are not allowed to delete this page!') 719 msg = _('You are not allowed to delete this page!')
720 raise self.AccessDenied(msg) 720 raise self.AccessDenied(msg)
721 721
722 try: 722 try:
723 msg = self.saveText(u"deleted\n", 0, comment=comment or u'', deleted=True, notify=False) 723 msg = self.saveText(u"deleted\n", 0, comment=comment or u'', deleted=True, notify=False)
1078 if not wikiutil.isTemplatePage(request, self.page_name): 1078 if not wikiutil.isTemplatePage(request, self.page_name):
1079 newtext = self._expand_variables(newtext) 1079 newtext = self._expand_variables(newtext)
1080 1080
1081 msg = "" 1081 msg = ""
1082 if not request.user.may.save(self, newtext, rev, **kw): 1082 if not request.user.may.save(self, newtext, rev, **kw):
1083 log_attempt('edit: edit', False, request) 1083 log_attempt('edit: edit', False, request, name=self.page_name)
1084 msg = _('You are not allowed to edit this page!') 1084 msg = _('You are not allowed to edit this page!')
1085 raise self.AccessDenied(msg) 1085 raise self.AccessDenied(msg)
1086 elif not self.isWritable(): 1086 elif not self.isWritable():
1087 log_attempt('edit: immutable', False, request) 1087 log_attempt('edit: immutable', False, request, name=self.page_name)
1088 msg = _('Page is immutable!') 1088 msg = _('Page is immutable!')
1089 raise self.Immutable(msg) 1089 raise self.Immutable(msg)
1090 elif not newtext: 1090 elif not newtext:
1091 msg = _('You cannot save empty pages.') 1091 msg = _('You cannot save empty pages.')
1092 raise self.EmptyPage(msg) 1092 raise self.EmptyPage(msg)
1126 # of wating for next request. 1126 # of wating for next request.
1127 acl = self.getACL(request) 1127 acl = self.getACL(request)
1128 if (not request.user.may.admin(self.page_name) and 1128 if (not request.user.may.admin(self.page_name) and
1129 parseACL(request, newtext).acl != acl.acl and 1129 parseACL(request, newtext).acl != acl.acl and
1130 action != "SAVE/REVERT"): 1130 action != "SAVE/REVERT"):
1131 log_attempt('edit: acl', False, request) 1131 log_attempt('edit: acl', False, request, name=self.page_name)
1132 msg = _("You can't change ACLs on this page since you have no admin rights on it!") 1132 msg = _("You can't change ACLs on this page since you have no admin rights on it!")
1133 raise self.NoAdmin(msg) 1133 raise self.NoAdmin(msg)
1134 1134
1135 presave = PagePreSaveEvent(request, self, newtext) 1135 presave = PagePreSaveEvent(request, self, newtext)
1136 results = send_event(presave) 1136 results = send_event(presave)