Attachment 'inherit-parent-acl.diff'

Download

   1 * looking for arch@arch.thinkmo.de--2003-archives/moin--main--1.3--patch-556 to compare with
   2 * comparing to arch@arch.thinkmo.de--2003-archives/moin--main--1.3--patch-556
   3 M  MoinMoin/Page.py
   4 M  MoinMoin/PageEditor.py
   5 M  MoinMoin/multiconfig.py
   6 
   7 * modified files
   8 
   9 --- orig/MoinMoin/Page.py
  10 +++ mod/MoinMoin/Page.py
  11 @@ -1524,7 +1524,7 @@
  12                      return parent
  13          return None
  14  
  15 -    def getACL(self, request):
  16 +    def getACL(self, request, inherit=True):
  17          """ Get ACLs of this page.
  18  
  19          Page acl is cached for long running processes in the global
  20 @@ -1533,6 +1533,8 @@
  21          pages, the previous revision is saved.
  22  
  23          @param request: the request object
  24 +        @param inherit: should parent acl be inherited
  25 +        @type inherit: bool
  26          @rtype: MoinMoin.wikiacl.AccessControlList
  27          @return: ACL of this page
  28          """
  29 @@ -1556,13 +1558,19 @@
  30          key = (request.cfg.siteid, self.page_name)
  31          aclRevision, acl = _acl_cache.get(key, (None, None))
  32          
  33 -        if aclRevision != revision or acl is None:
  34 +        if (request.cfg.acl_inherit_parent and not inherit) or aclRevision != revision or acl is None:
  35              # Parse acl from page and save in cache
  36              if exists:
  37                  body = self.get_raw_body()
  38              else:
  39                  body = Page(request, self.page_name, rev=revision).get_raw_body()
  40              acl = wikiacl.parseACL(request, body)
  41 +            if request.cfg.acl_inherit_parent and inherit:
  42 +                parent = self.getParentPage()
  43 +                if parent:
  44 +                    pacl = parent.getACL(request)
  45 +                    if pacl:
  46 +                        acl.setLines(request.cfg, acl.acl_lines + pacl.acl_lines)
  47              _acl_cache[key] = (revision, acl)
  48          
  49          request.clock.stop('getACL')
  50 
  51 
  52 --- orig/MoinMoin/PageEditor.py
  53 +++ mod/MoinMoin/PageEditor.py
  54 @@ -903,7 +903,7 @@
  55              # they are not the sames, the user must have admin
  56              # rights. This is a good place to update acl cache - instead
  57              # of wating for next request.
  58 -            acl = self.getACL(self.request)
  59 +            acl = self.getACL(self.request, inherit=False)
  60              if (not acl.may(self.request, self.request.user.name, "admin") and
  61                  parseACL(self.request, newtext) != acl and
  62                  action != "SAVE/REVERT"):
  63 
  64 
  65 --- orig/MoinMoin/multiconfig.py
  66 +++ mod/MoinMoin/multiconfig.py 
  67 @@ -151,6 +151,7 @@
  68      FIXME: update according to MoinMoin:UpdateConfiguration
  69      """    
  70      acl_enabled = 0
  71 +    acl_inherit_parent = 0
  72      # All acl_right lines must use unicode!
  73      acl_rights_default = u"Trusted:read,write,delete,revert Known:read,write,delete,revert All:read,write"
  74      acl_rights_before = u""

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-06-12 13:12:37, 9.7 KB) [[attachment:hierachical-acl-666.diff]]
  • [get | view] (2005-11-21 12:20:12, 9.0 KB) [[attachment:hierachical-acl-moin--main--1.3-935.diff]]
  • [get | view] (2005-01-19 19:05:25, 9.6 KB) [[attachment:hierachical-acl.diff]]
  • [get | view] (2005-01-18 08:11:27, 2.7 KB) [[attachment:inherit-parent-acl.diff]]
  • [get | view] (2005-01-18 08:57:38, 3.3 KB) [[attachment:split-before-after.diff]]
 All files | Selected Files: delete move to page copy to page

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