summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorBjörn Baumbach <bb@sernet.de>2020-01-21 11:39:30 +0100
committerStefan Metzmacher <metze@samba.org>2020-01-21 14:38:45 +0000
commit41262d1d66c18e3ea2f2f3c009a88ef830d25aa4 (patch)
tree57ff3841341e47eabe026b380568632724932abc /python
parentd2d345103b20b0bb72073b785b7b4cc4552c8335 (diff)
downloadsamba-41262d1d66c18e3ea2f2f3c009a88ef830d25aa4.tar.gz
samba-tool: add --full-dn option for user getgroups command
Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Ralph Boehme <slow@samba.org>
Diffstat (limited to 'python')
-rw-r--r--python/samba/netcmd/user.py19
1 files changed, 17 insertions, 2 deletions
diff --git a/python/samba/netcmd/user.py b/python/samba/netcmd/user.py
index 9a1883fea1f..b04ee49d018 100644
--- a/python/samba/netcmd/user.py
+++ b/python/samba/netcmd/user.py
@@ -764,12 +764,21 @@ The username specified on the command is the sAMAccountName."""
takes_options = [
Option("-H", "--URL", help="LDB URL for database or target server",
type=str, metavar="URL", dest="H"),
+ Option("--full-dn", dest="full_dn",
+ default=False,
+ action='store_true',
+ help="Display DN instead of the sAMAccountName."),
]
takes_args = ["username"]
- def run(self, username, credopts=None, sambaopts=None,
- versionopts=None, H=None):
+ def run(self,
+ username,
+ credopts=None,
+ sambaopts=None,
+ versionopts=None,
+ H=None,
+ full_dn=False):
lp = sambaopts.get_loadparm()
creds = credopts.get_credentials(lp)
@@ -810,6 +819,12 @@ The username specified on the command is the sAMAccountName."""
except IndexError:
raise CommandError("Unable to find primary group '%s'" % (primarygroup_sid_dn))
+ if full_dn:
+ self.outf.write("%s\n" % primary_group_dn)
+ for group_dn in user_groups:
+ self.outf.write("%s\n" % group_dn)
+ return
+
group_names = []
for gdn in user_groups:
try: