/usr/share/pyshared/MoinMoin/xmlrpc/UpdateGroup.py is in python-moinmoin 1.9.3-1ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | # -*- coding: iso-8859-1 -*-
"""
MoinMoin - Wiki XMLRPC group creation
@copyright: 2005-2006 Bastian Blank, Florian Festi, Thomas Waldmann
@license: GNU GPL, see COPYING for details.
"""
import sys, xmlrpclib
from MoinMoin import log
logging = log.getLogger(__name__)
from MoinMoin.PageEditor import PageEditor
def execute(self, groupname, groupcomment, memberlist, pageacls=u"All:read"):
"""
create or overwrite a group definition page
@param groupname: the page name of the group definition page (unicode or utf-8)
must match the page_group_regex or it won't have effect
@param memberlist: the group members (unicode or utf-8)
@param pageacls: the ACLs to use for the group page (defaults to u"All:read")
@rtype: bool
@return: true on success
"""
pagename = self._instr(groupname)
# also check ACLs
if not self.request.user.may.write(pagename):
return xmlrpclib.Fault(1, "You are not allowed to edit this page")
# check if groupname matches page_group_regex
if not self.request.cfg.cache.page_group_regexact.search(groupname):
return xmlrpclib.Fault(2, "The groupname %s does not match your page_group_regex (%s)" % (
groupname, self.request.cfg.page_group_regex))
newtext = """\
#acl %(acl)s
%(comment)s
%(memberlist)s
""" % {
'acl': pageacls,
'comment': groupcomment,
'memberlist': "\n * ".join([''] + memberlist)
}
page = PageEditor(self.request, pagename)
try:
msg = page.saveText(newtext, 0)
except page.SaveError, msg:
logging.error("SaveError msg: %s" % str(msg))
return xmlrpclib.Fault(3, msg)
if msg:
logging.debug("saveText msg: %s" % msg)
#we need this to update pagelinks cache:
#self.request.args = self.request.form = self.request.setup_args()
self.request.redirectedOutput(page.send_page, content_only=1)
return xmlrpclib.Boolean(1)
|