Attachment 'policy.py'

Download

   1 """
   2 Give automatic admin rights for users for their home page or sub pages.
   3 
   4 Bypass page acl for the "owner" of the page, use page acl for other 
   5 users. Amdins always has admin rights if they are in acl_rights_before.
   6 
   7 Note that anyone can register with an existing page name and then admin that page ignoring the page acl.
   8 """
   9 
  10 # If you want to use antispam, sub class from antispam:
  11 # from MoinMoin.util.antispam import SecurityPolicy as Permissions
  12 from MoinMoin.security import Permissions
  13 
  14 from MoinMoin import wikiutil
  15 
  16 class SecurityPolicy(Permissions):
  17     def admin(self, pagename):
  18         # Give right if page name starts with username, bypassing page acl
  19         if (self.request.user.valid and 
  20             pagename.startswith(self.request.user.name) and
  21             (not wikiutil.isSystemPage(self.request, pagename))):
  22             return True
  23 
  24         # Use base class policy:
  25         return Permissions.__getattr__(self, 'admin')(pagename)
  26         

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2005-04-11 23:08:21, 0.9 KB) [[attachment:policy.py]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.