mirror of
https://github.com/samba-team/samba.git
synced 2025-01-26 10:04:02 +03:00
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>
This commit is contained in:
parent
d2d345103b
commit
41262d1d66
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user