1.1 --- a/MoinSupport.py Sat Jan 19 21:17:18 2013 +0100
1.2 +++ b/MoinSupport.py Sat Jan 19 23:12:05 2013 +0100
1.3 @@ -880,6 +880,7 @@
1.4
1.5 "Initialise an item store for the given 'page'."
1.6
1.7 + self.page = page
1.8 self.path = page.getPagePath(item_dir_name)
1.9 self.next_path = os.path.join(self.path, "next")
1.10 lock_dir = page.getPagePath(lock_dir_name)
1.11 @@ -941,6 +942,9 @@
1.12
1.13 "Append the given 'item' to the store."
1.14
1.15 + if not self.can_write():
1.16 + return
1.17 +
1.18 self.lock.acquire()
1.19 try:
1.20 next = self.get_next()
1.21 @@ -949,4 +953,14 @@
1.22 finally:
1.23 self.lock.release()
1.24
1.25 + def can_write(self):
1.26 +
1.27 + """
1.28 + Return whether the user associated with the request can write to the
1.29 + page owning this store.
1.30 + """
1.31 +
1.32 + user = self.page.request.user
1.33 + return user and user.may.write(self.page.page_name)
1.34 +
1.35 # vim: tabstop=4 expandtab shiftwidth=4