view data/plugin/security/bbb_access_data.snippet @ 603:fa6bb1f3c86c

security: bbb_access_data.snippet requires now logged in users for bbb parser
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Thu, 14 Jun 2012 13:47:12 +0200
parents ba791ad6c846
children 127da830be6c
line wrap: on
line source
# -*- coding: iso-8859-1 -*-
"""
    MoinMoin - SecurityPolicy implementing limitation for bbb_create parser

    Example:
    you have to copy this snippet below your Config definition in wikiconfig.py 
    or you add it to the main security folder and import it into your Config definition.


    @copyright: 2012 MoinMoin:ReimarBauer
    @license: GNU GPL, see COPYING for details.
"""

from MoinMoin.Page import Page
from MoinMoin.security import Permissions


class SecurityPolicy(Permissions):
    def read(self, page_name):
        request = self.request
        page = Page(request, page_name)
        format = page.pi['format']
        if format == "bbb_create":
            if request.user.valid and request.action == u"show" or request.user.may.write(page_name):
                return True
            return False
        return Permissions.__getattr__(self, 'read')(page_name)