Pascal Bauermeister

<pascal DOT bauermeister AT gmail DOT com>

Extensions I wrote for MoinMoin

Rules-based ACL

In addition to per-page ACLs and default ACLs (acl_rights_*), here is how one can implement ACLs based on the page name, in order to defines "Wiki zones". This will replace usual ACLs (sorry but you cannot override the rules below). It allows us to create extranet zones, where 3rd parties can freely access pages which path starts as specified. Add to wikiconfig.py:

    ACL_ZONES = (
        # Group               # Page starts with (or ends with, if "*any")
        ("*",                 "*Template"), # any valid user may see any tmpl

        ("AcmeGroup",         "Acme"),
        ("AcmeGroup",         "Utilities"),
        ("AcmeGroup",         "HelpOnProducts"),

        ("BildoonGroup",      "BuSab2005Project"),
        ("BildoonGroup",      "BuSab2006Project"),
        ("BildoonGroup",      "News"),

        ("CinderellaGroup",   "CinderellaProject"),

        ("GuestGroup",        "Engineering"),
        ("GuestGroup",        "News"),
        ("GuestGroup",        "*Project"),
        )

    from MoinMoin.security import Permissions
    class SecurityPolicy(Permissions):

        def may_do(self, pagename, op):
            from MoinMoin.security import Permissions
            from MoinMoin.Page import Page

            req = self.request
            user_name = req.user.name
            may = Page(req, pagename).getACL(req).may(req, user_name, op)
            res = may # default perm

            # additional right, given on page name vs group
            if req.user.valid:
                for group, prefix in Config.ACL_ZONES:
                    if res: break
                    gok = group=="*" or req.dicts.has_member (group, user_name)
                    if not gok: continue
                    if prefix.startswith ("*"):
                        res = pagename.endswith (prefix[1:])
                    else:
                        res = pagename.startswith (prefix)
            return res

        def edit  (self, pname, **kw): return self.may_do (pname, 'edit')
        def write (self, pname, **kw): return self.may_do (pname, 'write')
        def read  (self, pname, **kw): return self.may_do (pname, 'read')
        def revert(self, pname, **kw): return self.may_do (pname, 'revert')
        def admin (self, pname, **kw): return self.may_do (pname, 'admin')
        def delete(self, pname, **kw): return self.may_do (pname, 'delete')

Messages to me

You can drop some feedback here:

I like your new Processor!!
I've been trying to get Html2Moin-MoinConverter to convert an M$ Word document and it kept on choking on lists inside table, which M$ Word seems to do quite often. The other thing that M$ Word does is put paragraphs inside tables. Can IndentTable handle this?
-- CraigJohnson 2004-07-29 15:32:21


Comment on IndentTable for moin1.3 release 2004.11.21 by StigIversen:

Better replace cStringIO with StringIO, else unicode error can occur in format function. IndentTable-moin1.3.diff


Servus Pascal, I have a oneliner for SearchInPagesAndSort. If attachments are included on a page, they have to be expanded to point to that other page. this is what i did (right before store info, around line 600)

                    # expand attachments
                    line = re.sub(r'attachment:(.*?)\s','[attachment:'+page_name+r'/\1 \1]',line)


Comment on PdfAction for moin1.5.8 release 2008.02.05 by Nihad Perva:

Hi,

i just installed htmldoc and your plugin ActionMarket/PdfAction and it works great but attached .png graphics are not converted into the pdf. any suggestions?

I'm sorry i didn't read the whole project page, but now i know what the problem is. I'm using NTLM-Auth against Active Directory and your plugin can not handle that authentication. Is it possible to integrate the standard authentication from auth.py?


-- PhilippHoefflin 2008-03-03 12:19:19 - Comment on ActionMarket/PdfAction

 <table style="width: 90%"> instead of just <table>. My quick and dirty fix was to add an extra regex:

html = re.compile(r'<table>').sub(u'<table border="1" cellpadding="5">', html)
# that's what I added:
html = re.compile(r'<table ').sub(u'<table border="1" cellpadding="5" ', html)

I guess there's a better way to do that but I don't know any python. Greetings, Philipp.


CategoryHomepage

MoinMoin: PascalBauermeister (last edited 2008-03-03 12:19:19 by PhilippHoefflin)