|
|
@@ -14,6 +14,7 @@
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
# See the License for the specific language governing permissions and
|
|
|
# limitations under the License.
|
|
|
+
|
|
|
from django.core.management.base import BaseCommand, CommandError
|
|
|
from django.utils.translation import ugettext_lazy as _t, ugettext as _
|
|
|
|
|
|
@@ -22,6 +23,7 @@ from desktop.conf import LDAP
|
|
|
from useradmin import ldap_access
|
|
|
from useradmin.views import import_ldap_groups
|
|
|
|
|
|
+
|
|
|
class Command(BaseCommand):
|
|
|
"""
|
|
|
Handler for importing LDAP groups into the Hue database.
|
|
|
@@ -31,22 +33,18 @@ class Command(BaseCommand):
|
|
|
all unimported users.
|
|
|
"""
|
|
|
def add_arguments(self, parser):
|
|
|
- parser.add_argument("--dn", help=_t("Whether or not the user should be imported by "
|
|
|
- "distinguished name."),
|
|
|
- action="store_true",
|
|
|
- default=False)
|
|
|
- parser.add_argument("--import-members", help=_t("Import users from the group."),
|
|
|
- action="store_true",
|
|
|
- default=False)
|
|
|
- parser.add_argument("--import-members-recursive", help=_t("Import users from the group, but also do so recursively."),
|
|
|
- action="store_true",
|
|
|
- default=False)
|
|
|
- parser.add_argument("--sync-users", help=_t("Sync users in the group."),
|
|
|
- action="store_true",
|
|
|
- default=False)
|
|
|
- parser.add_argument("--server", help=_t("Server to connect to."),
|
|
|
- action="store",
|
|
|
- default=None)
|
|
|
+ parser.add_argument('group', nargs='+', type=str)
|
|
|
+
|
|
|
+ parser.add_argument("--dn", help=_t("Whether or not the user should be imported by distinguished name."), action="store_true", default=False)
|
|
|
+ parser.add_argument("--import-members", help=_t("Import users from the group."), action="store_true", default=False)
|
|
|
+ parser.add_argument(
|
|
|
+ "--import-members-recursive",
|
|
|
+ help=_t("Import users from the group, but also do so recursively."),
|
|
|
+ action="store_true",
|
|
|
+ default=False
|
|
|
+ )
|
|
|
+ parser.add_argument("--sync-users", help=_t("Sync users in the group."), action="store_true", default=False)
|
|
|
+ parser.add_argument("--server", help=_t("Server to connect to."), action="store", default=None)
|
|
|
|
|
|
def handle(self, group=None, **options):
|
|
|
if group is None:
|