view MoinMoin/script/old/xmlrpc-tools/UpdateGroupTest.py @ 3115:cd6cfc715261

replace wikiwikiweb.de by moinmo.in, replace contact Juergen Hermann by Thomas Waldmann, cleanup wikiconfig (ported from 1.6)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 25 Feb 2008 23:53:55 +0100
parents 01f05e74aa9c
children 6d9652a1db90
line wrap: on
line source

#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This script is just an example how to update a group definition page using xmlrpc.

GPL software, 2005 Thomas Waldmann
"""
def run():
    import sys
    sys.path.insert(0, '../../..')

    import xmlrpclib
    from MoinMoin.support.BasicAuthTransport import BasicAuthTransport

    user = "XmlRpc"
    password = "wrong"
    dsttrans = BasicAuthTransport(user, password)
    mywiki = xmlrpclib.ServerProxy("http://master.moinmo.in/?action=xmlrpc2", transport=dsttrans)

    groupname = "TestGroup"
    groupdesc = "This is just a test."
    groupmembers = ["TestUser1", "TestUser2", ]
    print mywiki.UpdateGroup(groupname, groupdesc, groupmembers)

    groupname = "TestAclGroup"
    groupdesc = "This is just a test."
    groupmembers = ["TestUser3", ]
    print mywiki.UpdateGroup(groupname, groupdesc, groupmembers, "All:read,write,delete,revert")

    del mywiki
    del dsttrans

    user = "XmlRpc"
    password = "completelywrong"
    dsttrans = BasicAuthTransport(user, password)
    mywiki = xmlrpclib.ServerProxy("http://master.moinmo.in/?action=xmlrpc2", transport=dsttrans)

    groupname = "TestGroup"
    groupdesc = "This is just a test."
    groupmembers = ["WrongUser1", "WrongUser2", ]
    print mywiki.UpdateGroup(groupname, groupdesc, groupmembers)


if __name__ == "__main__":
    run()