diff --git apps/useradmin/src/useradmin/management/commands/import_ldap_group.py apps/useradmin/src/useradmin/management/commands/import_ldap_group.py index a2d6cf8..1ed75be 100644 --- apps/useradmin/src/useradmin/management/commands/import_ldap_group.py +++ apps/useradmin/src/useradmin/management/commands/import_ldap_group.py @@ -16,7 +16,7 @@ # limitations under the License. from optparse import make_option -from useradmin.views import import_ldap_group +from useradmin.views import import_ldap_groups from django.core.management.base import BaseCommand, CommandError @@ -39,6 +39,12 @@ class Command(BaseCommand): make_option("--import-members", help=_("Import users from the group."), action="store_true", default=False), + make_option("--import-members-recursive", help=_("Import users from the group, but also do so recursively."), + action="store_true", + default=False), + make_option("--sync-users", help=_("Sync users in the group."), + action="store_true", + default=False), ) args = "group-name" @@ -49,4 +55,6 @@ class Command(BaseCommand): import_members = options['import_members'] import_by_dn = options['dn'] - import_ldap_group(group, import_members, import_by_dn) + import_members_recursive = options['import_members_recursive'] + sync_users = options['sync_users'] + import_ldap_groups(group, import_members, import_members_recursive, sync_users, import_by_dn) diff --git apps/useradmin/src/useradmin/management/commands/import_ldap_user.py apps/useradmin/src/useradmin/management/commands/import_ldap_user.py index 225eb0b..5878d3c 100644 --- apps/useradmin/src/useradmin/management/commands/import_ldap_user.py +++ apps/useradmin/src/useradmin/management/commands/import_ldap_user.py @@ -16,7 +16,7 @@ # limitations under the License. from optparse import make_option -from useradmin.views import import_ldap_user +from useradmin.views import import_ldap_users from django.core.management.base import BaseCommand, CommandError @@ -34,6 +34,9 @@ class Command(BaseCommand): "distinguished name."), action="store_true", default=False), + make_option("--sync-groups", help=_("Sync groups of the users."), + action="store_true", + default=False), ) args = "username" @@ -43,4 +46,5 @@ class Command(BaseCommand): raise CommandError(_("A username must be provided.")) import_by_dn = options['dn'] - import_ldap_user(user, import_by_dn) + sync_groups = options['sync_groups'] + import_ldap_users(user, sync_groups, import_by_dn)