Example #1
0
def permissions(request):
    """Sets a few variables if it's a ductus document"""
    rv = {}
    if hasattr(request, 'ductus'):
        from ductus.wiki import user_has_edit_permission
        if request.ductus.wiki_page:
            rv['page_is_editable_by_user'] = user_has_edit_permission(request.user, *request.ductus.wiki_page.split_pagename())
    return rv
Example #2
0
def permissions(request):
    """Sets a few variables if it's a ductus document"""
    rv = {}
    if hasattr(request, 'ductus'):
        from ductus.wiki import user_has_edit_permission
        if request.ductus.wiki_page:
            rv['page_is_editable_by_user'] = user_has_edit_permission(
                request.user, *request.ductus.wiki_page.split_pagename())
    return rv
Example #3
0
def check_create_permission(request, prefix, pagename, status=404):
    if not user_has_edit_permission(request.user, prefix, pagename):
        t = loader.get_template('wiki/no_create_permission.html')
        raise ImmediateResponse(t.render(RequestContext(request)),
                                status=status)