Example #1
0
def handle_command(args):
    if args.subcommand == "list":
        session = make_session()
        all_users = get_all_users(session)
        for user in all_users:
            user_enabled = "enabled" if user.enabled else "disabled"
            logging.info("{} has status {}".format(user.name, user_enabled))
        return

    else:
        user_command(args)
Example #2
0
    def run(self, args):
        # type: (Namespace) -> None
        if args.subcommand == "convert_to_service_account":
            usecase = self.usecase_factory.create_convert_user_to_service_account_usecase(
                args.actor_name, self)
            usecase.convert_user_to_service_account(args.username, args.owner)

        elif args.subcommand == "list":
            session = make_session()
            all_users = get_all_users(session)
            for user in all_users:
                user_enabled = "enabled" if user.enabled else "disabled"
                logging.info("{} has status {}".format(user.name,
                                                       user_enabled))
            return

        else:
            user_command(args)
Example #3
0
    def run(self, args):
        # type: (Namespace) -> None
        if args.subcommand == "convert_to_service_account":
            subcommand = ConvertUserToServiceAccountCommand(self.usecase_factory)
            subcommand.run(args)

        elif args.subcommand == "list":
            # Ugly temporary hack until this is converted to a usecase.
            repository_factory = self.usecase_factory.service_factory.repository_factory
            session = repository_factory.session_factory.create_session()
            all_users = get_all_users(session)
            for user in all_users:
                user_enabled = "enabled" if user.enabled else "disabled"
                logging.info("{} has status {}".format(user.name, user_enabled))
            return

        else:
            # Ugly temporary hack until this is converted to a usecase.
            repository_factory = self.usecase_factory.service_factory.repository_factory
            user_command(args, self.settings, repository_factory.session_factory)