mirror of
https://github.com/samba-team/samba.git
synced 2025-07-14 12:59:07 +03:00
samba-tool: moved takes_optiongroups definition to Command base class
The option groups should be defined at the Command base class level as they are in common across all samba-tool commands. Major move advantages: 1. more OOP approach 2. enforcing consistency across commands 3. avoiding the need of declaring for every new command Signed-off-by: Andrew Tridgell <tridge@samba.org>
This commit is contained in:
committed by
Andrew Tridgell
parent
1dfcb019d2
commit
f6fa868489
@ -4,6 +4,7 @@
|
||||
#
|
||||
# Copyright Jelmer Vernooij 2010 <jelmer@samba.org>
|
||||
# Copyright Theresa Halloran 2011 <theresahalloran@gmail.com>
|
||||
# Copyright Giampaolo Lauria 2011 <lauria2@yahoo.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -39,12 +40,6 @@ class cmd_user_add(Command):
|
||||
"""Create a new user."""
|
||||
synopsis = "%prog user add <name> [<password>]"
|
||||
|
||||
takes_optiongroups = {
|
||||
"sambaopts": options.SambaOptions,
|
||||
"credopts": options.CredentialsOptions,
|
||||
"versionopts": options.VersionOptions,
|
||||
}
|
||||
|
||||
takes_args = ["name", "password?"]
|
||||
|
||||
def run(self, name, password=None, credopts=None, sambaopts=None, versionopts=None):
|
||||
@ -60,12 +55,6 @@ class cmd_user_delete(Command):
|
||||
"""Delete a user."""
|
||||
synopsis = "%prog user delete <name>"
|
||||
|
||||
takes_optiongroups = {
|
||||
"sambaopts": options.SambaOptions,
|
||||
"credopts": options.CredentialsOptions,
|
||||
"versionopts": options.VersionOptions,
|
||||
}
|
||||
|
||||
takes_args = ["name"]
|
||||
|
||||
def run(self, name, credopts=None, sambaopts=None, versionopts=None):
|
||||
@ -83,13 +72,6 @@ class cmd_user_enable(Command):
|
||||
|
||||
synopsis = "%prog user enable <username> [options]"
|
||||
|
||||
|
||||
takes_optiongroups = {
|
||||
"sambaopts": options.SambaOptions,
|
||||
"versionopts": options.VersionOptions,
|
||||
"credopts": options.CredentialsOptions,
|
||||
}
|
||||
|
||||
takes_options = [
|
||||
Option("-H", help="LDB URL for database or target server", type=str),
|
||||
Option("--filter", help="LDAP Filter to set password on", type=str),
|
||||
@ -122,12 +104,6 @@ class cmd_user_setexpiry(Command):
|
||||
|
||||
synopsis = "%prog user setexpiry <username> [options]"
|
||||
|
||||
takes_optiongroups = {
|
||||
"sambaopts": options.SambaOptions,
|
||||
"versionopts": options.VersionOptions,
|
||||
"credopts": options.CredentialsOptions,
|
||||
}
|
||||
|
||||
takes_options = [
|
||||
Option("-H", help="LDB URL for database or target server", type=str),
|
||||
Option("--filter", help="LDAP Filter to set password on", type=str),
|
||||
@ -165,12 +141,6 @@ class cmd_user_setpassword(Command):
|
||||
|
||||
synopsis = "%prog user setpassword [username] [options]"
|
||||
|
||||
takes_optiongroups = {
|
||||
"sambaopts": options.SambaOptions,
|
||||
"versionopts": options.VersionOptions,
|
||||
"credopts": options.CredentialsOptions,
|
||||
}
|
||||
|
||||
takes_options = [
|
||||
Option("-H", help="LDB URL for database or target server", type=str),
|
||||
Option("--filter", help="LDAP Filter to set password on", type=str),
|
||||
|
Reference in New Issue
Block a user