Commit c3d4308a authored by Vincent Le gallic's avatar Vincent Le gallic Committed by Pierre-Elliott Bécue

[wiki/macros] Méthode pour mieux voir les ACL des utilisateurs

parent 2cd0e946
# -*- coding: utf-8 -*-
"""
MoinMoin - ShowAcl macro
@copyright: 2014 Vincent Le Gallic
@license: GNU GPL v3
Pour montrer les ACL effectif de l'utilisateur courant.
"""
from MoinMoin import wikiutil
from MoinMoin.Page import Page
def macro_ShowAcl(macro, args):
request = macro.request
_ = macro.request.getText
pagename = request.themedict["page_name"]
page = Page(request, pagename)
acl = page.getACL(request)
permissions = ["read", "write", "delete", "revert", "admin"]
permissions = [x for x in permissions if acl.may(request, request.user, x)]
sRet = "Les ACL de la page : %s\n" % (acl.__dict__,) + "Vos ACL : " + ", ".join(permissions)
return macro.formatter.text(sRet)
def execute(macro, args):
try:
return wikiutil.invoke_extension_function(
macro.request, macro_ShowAcl, args, [macro])
except ValueError, err:
return macro.request.formatter.text(
"<<ShowAcl: %s>>" % err.args[0])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment