From 544dc4465c5ade3c5ed8417ddd5f09d4af0c2b31 Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Sat, 8 May 2010 00:48:33 +0200 Subject: s4:net utility - add an optional password attribute to "net user add" To make it behave similar to "net newuser". --- source4/scripting/python/samba/netcmd/user.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'source4/scripting') diff --git a/source4/scripting/python/samba/netcmd/user.py b/source4/scripting/python/samba/netcmd/user.py index 7597f462b6..54ddfe2322 100644 --- a/source4/scripting/python/samba/netcmd/user.py +++ b/source4/scripting/python/samba/netcmd/user.py @@ -29,7 +29,7 @@ from samba.netcmd import ( class cmd_user_add(Command): """Create a new user.""" - synopsis = "%prog user add " + synopsis = "%prog user add []" takes_optiongroups = { "sambaopts": options.SambaOptions, @@ -37,13 +37,15 @@ class cmd_user_add(Command): "versionopts": options.VersionOptions, } - takes_args = ["name"] + takes_args = ["name", "password?"] - def run(self, name, credopts=None, sambaopts=None, versionopts=None): + def run(self, name, password=None, credopts=None, sambaopts=None, versionopts=None): lp = sambaopts.get_loadparm() creds = credopts.get_credentials(lp) net = Net(creds, lp) net.create_user(name) + if password is not None: + net.set_password(name, creds.get_domain(), password, creds) class cmd_user_delete(Command): -- cgit