summaryrefslogtreecommitdiff
path: root/python/samba/netcmd/group.py
AgeCommit message (Collapse)AuthorFilesLines
2025-01-23samba-tool group removemembers: avoid python backtrace on errorBjörn Baumbach1-1/+1
Pair-programmed-with: Stefan Metzmacher <metze@samba.org> Signed-off-by: Björn Baumbach <bb@sernet.de> Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jule Anger <janger@samba.org>
2023-11-22netcmd: fix typo in groups and computer commandsRob van der Linde1-1/+1
Everywhere else it is using Group's except for one place which makes it obvious this was incorrect. Same goes for Computers's vs Computer's Signed-off-by: Rob van der Linde <rob@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2022-10-05python: Handle LdbError thrown from functions operating on DNsJoseph Sutton1-5/+13
None of these functions can return False now. Instead we must catch the LdbError if we want to perform further error handling. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2022-03-18samba-tool group: Add --special parameter to add predefined special groupJoseph Sutton1-3/+194
This allows default security groups that have been added since Windows Server 2008 R2, such as Protected Users, to be created in pre-existing domains. An error message is generated if a group already exists with the same name, DN, or SID. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2021-04-26samba-tool group listmembers: always list objects which can not expireBjörn Baumbach1-2/+5
Otherwise for example contacts wouldn't be listed when the --hide-expired option is used. Contacts typically do not have the accountExpires attribute. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14692 Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Rowland penny <rpenny@samba.org> Autobuild-User(master): Björn Baumbach <bb@sernet.de> Autobuild-Date(master): Mon Apr 26 13:21:43 UTC 2021 on sn-devel-184
2021-01-15samba-tool: Optionally hide disabled/expired accounts in "group listmembers"Björn Baumbach1-3/+26
--hide-expired Do not list expired group members --hide-disabled Do not list disabled group members Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Fri Jan 15 16:34:11 UTC 2021 on sn-devel-184
2020-10-02python2 reduction: Merge remaining compat code into commonDavid Mulder1-1/+1
The remaining compat code (get_string, get_bytes, cmp) are useful helper routines which we should simply merge into common (especially since there is some duplication here). Signed-off-by: David Mulder <dmulder@suse.com> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Autobuild-User(master): David Mulder <dmulder@samba.org> Autobuild-Date(master): Fri Oct 2 14:49:36 UTC 2020 on sn-devel-184
2020-10-01samba-tool group: add 'group create' as synonym for 'group add'Jule Anger1-3/+4
Add 'group create' command for a symmetric set of samba-tool subcommands Signed-off-by: Jule Anger <ja@sernet.de> Reviewed-by: Björn Baumbach <bb@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2020-10-01samba-tool group: add new group 'rename' commandJule Anger1-0/+155
Usage: samba-tool group rename <groupname> [options] Rename a group and related attributes. This command allows to set the group's name related attributes. Use an empty attribute value to remove the specified attribute. The groupname specified on the command is the sAMAccountName. Example1: samba-tool group rename employees --samaccountname=staff Example1 shows how to change the sAMAaccountName of a group 'employees' to 'staff' on the local server. Signed-off-by: Jule Anger <ja@sernet.de> Reviewed-by: Björn Baumbach <bb@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2020-04-02samba-tool group show: only shows global security groups, this patch makes ↵Rowland Penny1-3/+2
it show all groups. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14335 Signed-off-by: Rowland Penny <rpenny@samba.org> Reviewed-by: Björn Baumbach <bb@samba.org> Autobuild-User(master): Björn Baumbach <bb@sernet.de> Autobuild-Date(master): Thu Apr 2 15:27:53 UTC 2020 on sn-devel-184
2020-02-28samba-tool group edit: use binary encoded group nameBjörn Baumbach1-1/+2
Allows to edit groups with names like e.g. 'group1 (xy)'. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14296 Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-02-28samba-tool group delete: use binary encoded group nameBjörn Baumbach1-1/+1
Allows to delete groups with names like e.g. 'group1 (xy)'. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14296 Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-02-28samba-tool group move: use binary encoded group nameBjörn Baumbach1-1/+1
Allows to move groups with names like e.g. 'group1 (xy)'. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14296 Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-02-28samba-tool group listmembers: use binary encoded group namesBjörn Baumbach1-1/+2
Allows to find groups with names like e.g. 'group1 (xy)'. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14296 Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-02-28samba-tool group listmembers: find group members by groups SIDBjörn Baumbach1-5/+6
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14296 Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-02-28samba-tool group listmembers: handle group-does-not-exist errorBjörn Baumbach1-9/+8
Return a error with a proper message instead of just do nothing when the target group does not exist. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14296 Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-02-28samba-tool group listmembers: hide python backtracke on command errorBjörn Baumbach1-1/+2
Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-01-21samba-tool group addmembers: avoid python traceback on member add failureBjörn Baumbach1-2/+2
Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Ralph Boehme <slow@samba.org>
2020-01-21samba-tool group addmembers: add --member-base-dn option for group member searchBjörn Baumbach1-2/+20
Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Ralph Boehme <slow@samba.org>
2020-01-21samba-tool group {add,remove}members: allow to use --member-dn in ↵Björn Baumbach1-11/+28
combination with listofmembers Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Ralph Boehme <slow@samba.org>
2020-01-21samba-tool group removemembers: adapt functionality to addmembers commandBjörn Baumbach1-6/+32
Adds --member-dn and --object-types options. Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Ralph Boehme <slow@samba.org>
2020-01-21samba-tool group addmembers: add --member-dn optionBjörn Baumbach1-4/+12
The --member-dn option allows to specify an object by it's DN. This is required to select a specific object if there are more than one with the same name. Multiple contacts can exist with the same name in different OUs. Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Ralph Boehme <slow@samba.org>
2020-01-21samba-tool group addmembers: add new option --object-typesBjörn Baumbach1-3/+20
With this option the admin can specify the object types of the group members which will be added to the group. The search filter for the objects will be created according to the types. Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Ralph Boehme <slow@samba.org>
2020-01-21samba-tool: add -b/--base-dn option to groups list commandJule Anger1-0/+6
With this option it's e.g. possible to list the groups of a specify OU or groups which are located under a different specific place in the AD. Signed-off-by: Jule Anger <ja@sernet.de> Pair-programmed-with: Björn Baumbach <bb@samba.org> Reviewed-by: Björn Baumbach <bb@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2020-01-21samba-tool: add --full-dn option to group listmembers commandJule Anger1-1/+15
With this option the command lists the groupmembers distinguished names instead of the sAMAccountName. Signed-off-by: Jule Anger <ja@sernet.de> Reviewed-by: Björn Baumbach <bb@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2020-01-21samba-tool: add --full-dn option to group list commandBjörn Baumbach1-3/+15
With this option the command lists the groups distringuished names instead of the sAMAccountNames. Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Ralph Boehme <slow@samba.org>
2019-11-29samba-tool {user,group,computer,contact} show: avoid base64 encoded strings ↵Björn Baumbach1-3/+2
if possible Be more user friendly and use clear text argument strings if possible. Signed-off-by: Björn Baumbach <bb@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-11-29samba-tool group show: fix a copy-paste mistakeBjörn Baumbach1-3/+3
Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-10-17samba-tool: Add facility to add rfc2307 attributes to an already created ↵Rowland Penny1-0/+96
user or group Signed-off-by: Rowland Penny <rpenny@samba.org> Reviewed-by: David Mulder <dmulder@suse.com> Reviewed-by: Andrew Bartlet <abartlet@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Thu Oct 17 12:21:55 UTC 2019 on sn-devel-184
2019-07-04samba-tool group: add 'edit' command to edit an AD group objectBjörn Baumbach1-0/+114
Same like the samba-tool user edit command. Signed-off-by: Björn Baumbach <bb@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-07-04samba-tool: fix format of command description (help messages)Björn Baumbach1-5/+5
Need to quote the backslash '\'. Signed-off-by: Björn Baumbach <bb@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-12-04netcmd: Minor changes to 'group stats' commandTim Beale1-18/+25
These changes were inadvertently left off 0c910245fca70948a3. (They were made to the 2nd patch-set iteration posted to the mailing-list, but for some reason the first patch-set got delivered). Changes are: + rework some variable names for better readability + Average members defaulted to int, so lost any floating point precision. + Replace 'Min members' (which was fairly meaningless) with 'Median members per group'. + Fix flake8 long line warnings Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-10-31netcmd: Add 'samba-tool group stats' commandTim Beale1-0/+98
With large domains it's hard to get an idea of how many groups there are, and how many users are in each group, on average. However, this could have a big impact on whether a problem can be reproduced or not. This patch dumps out some summary information so that you can get a quick idea of how big the groups are. Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org> Autobuild-Date(master): Wed Oct 31 03:40:41 CET 2018 on sn-devel-144
2018-10-31netcmd: Include num-members in 'samba-tool group list --verbose'Tim Beale1-11/+15
This adds an easy way for users to see (via samba-tool) how many members are in various groups, without querying the members for each individual group. For example, you could pipe this output to grep to check for groups with zero or one members (i.e. historic groups that may no longer make sense). Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-10-25samba-tool ldapcmp: remove unused importDouglas Bagnall1-1/+0
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Noel Power <npower@samba.org>
2018-09-06PEP8: fix E127: continuation line over-indented for visual indentJoe Guo1-1/+1
Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-08-24PEP8: fix E302: expected 2 blank lines, found 1Joe Guo1-0/+4
Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-08-24PEP8: fix E251: unexpected spaces around keyword / parameter equalsJoe Guo1-1/+1
Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-08-24PEP8: fix E226: missing whitespace around arithmetic operatorJoe Guo1-1/+1
Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-08-24PEP8: fix E202: whitespace before ')'Joe Guo1-1/+1
Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-08-24PEP8: fix E201: whitespace after '('Joe Guo1-2/+2
Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-08-24PEP8: fix E128: continuation line under-indented for visual indentJoe Guo1-11/+11
Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-08-24PEP8: fix E127: continuation line over-indented for visual indentJoe Guo1-2/+2
Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-08-24PEP8: fix E123: closing bracket does not match indentation of opening ↵Joe Guo1-6/+6
bracket's line Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-05-29python/samba/netcmd/group.py: add group showWilliam Brown1-0/+81
The samba-tool user command can show the ldif of a user. This is useful for groups also, especially to determine the objectSID and objectGUID. Add support for group show to samba-tool. Signed-off-by: William Brown <william@blackhats.net.au> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2018-02-15samba-tool: convert 'except X, e' to 'except X as e' for all XDouglas Bagnall1-7/+7
This is needed for Python 3 and is compatible with python 2.6 Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-02-08samba-tool group: implement the group move commandBjörn Baumbach1-0/+79
This new command allows to move a a group into an ou or container. Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2017-06-09samba-tool: You cannot add members to a group if the member exists as a ↵Rowland Penny1-0/+2
sAMAccountName and a CN. Signed-off-by: Rowland Penny <rpenny@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org> Autobuild-User(master): Alexander Bokovoy <ab@samba.org> Autobuild-Date(master): Fri Jun 9 23:24:47 CEST 2017 on sn-devel-144
2016-09-30bug 12293: stop group.py throwing errors if group is unknownRowland Penny1-3/+15
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12293 Signed-off-by: Rowland Penny <rpenny@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org> Autobuild-User(master): Alexander Bokovoy <ab@samba.org> Autobuild-Date(master): Fri Sep 30 05:53:17 CEST 2016 on sn-devel-144
2015-02-17group.py: Fix wrong example option, remove wrong comment lineMarc Muehlfeld1-2/+1
Replaced "--gid" with the correct "--gid-number" in Example 3. Additionally removed the first comment line in group.py, which was wrong in that file. Signed-off-by: Marc Muehlfeld <mmuehlfeld@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>