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>
takes_options = [
Option("-H", "--URL", help="LDB URL for database or target server", type=str,
metavar="URL", dest="H"),
takes_options = [
Option("-H", "--URL", help="LDB URL for database or target server", type=str,
metavar="URL", dest="H"),
+ Option("--object-types",
+ help=("Comma separated list of object types.\n"
+ "The types are used to filter the search for the "
+ "specified members.\n"
+ "Valid values are: user, group, computer, serviceaccount, "
+ "contact and all.\n"
+ "Default: user,group,computer"),
+ default="user,group,computer",
+ type=str),
]
takes_args = ["groupname", "listofmembers"]
]
takes_args = ["groupname", "listofmembers"]
- def run(self, groupname, listofmembers, credopts=None, sambaopts=None,
- versionopts=None, H=None):
+ def run(self,
+ groupname,
+ listofmembers,
+ credopts=None,
+ sambaopts=None,
+ versionopts=None,
+ H=None,
+ object_types="user,group,computer"):
lp = sambaopts.get_loadparm()
creds = credopts.get_credentials(lp, fallback_machine=True)
lp = sambaopts.get_loadparm()
creds = credopts.get_credentials(lp, fallback_machine=True)
samdb = SamDB(url=H, session_info=system_session(),
credentials=creds, lp=lp)
groupmembers = listofmembers.split(',')
samdb = SamDB(url=H, session_info=system_session(),
credentials=creds, lp=lp)
groupmembers = listofmembers.split(',')
+ group_member_types = object_types.split(',')
samdb.add_remove_group_members(groupname, groupmembers,
samdb.add_remove_group_members(groupname, groupmembers,
- add_members_operation=True)
+ add_members_operation=True,
+ member_types=group_member_types)
except Exception as e:
# FIXME: catch more specific exception
raise CommandError('Failed to add members "%s" to group "%s"' % (
except Exception as e:
# FIXME: catch more specific exception
raise CommandError('Failed to add members "%s" to group "%s"' % (