create kolab user from command line

Timotheus Pokorra timotheus at kolab.org
Sat Oct 3 08:46:36 CEST 2015


Hello,


> Yes, this is ok, but would be more useful if i can pass the arguments
> directly from the command, so can automate this in a shell script.
Another user on the mailinglist wants such a feature as well.
Please file a bug report, and perhaps we can do a bounty on that feature?
see http://lists.kolab.org/pipermail/users/2015-September/019993.html


> P.S.: In the python script i can set the password for kolab users?
I just ran the kolab user-add with parameter -d 9 to see what is
transmitted. The result is also interesting, because it shows even the
names of the variables that are not set, eg. userpassword.

So this is how you can create a new user with a password:

vi /usr/lib/python2.7/site-packages/pykolab/wap_client/__init__.py

def user_add(params=None):
    params = {"type_id": "1", "preferredlanguage": "en_US",
"object_type": "user", "objectclass": ["top", "inetorgperson",
"kolabinetorgperson", "mailrecipient", "organizationalperson",
"person"], "sn": "Pokorra", "ou":
"ou=people,dc=kolab,dc=pokorra,dc=de", "givenname": "Timotheus",
"userpassword": "topsecret"}
    if params == None:
        params = get_user_input()

    params = json.dumps(params)

    return request('POST', 'user.add', post=params)

hope this helps,
  Timotheus


More information about the users mailing list