consolecommands/Kernel/System/Console/Command/Admin/CustomerUser/List.pm
2023-05-28 14:21:29 +02:00

79 lines
2.7 KiB
Perl

# --
# OTOBO is a web-based ticketing system for service organisations.
# --
# Copyright (C) 2001-2020 OTRS AG, https://otrs.com/
# Copyright (C) 2019-2023 Rother OSS GmbH, https://otobo.de/
# --
# 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 the Free Software
# Foundation, either version 3 of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# --
package Kernel::System::Console::Command::Admin::CustomerUser::Add;
use strict;
use warnings;
use parent qw(Kernel::System::Console::BaseCommand);
our @ObjectDependencies = (
'Kernel::System::CustomerUser',
);
sub Configure {
my ( $Self, %Param ) = @_;
$Self->Description('List or search for customer users.');
$Self->AddOption(
Name => 'search-term',
Description => "Term to search by for customer users.",
Required => 0,
HasValue => 1,
ValueRegex => qr/.*/smx,
);
$Self->AddOption(
Name => 'source',
Description => "Filter by one or more comma-separated sources.",
Required => 0,
HasValue => 1,
ValueRegex => qr/.*/smx,
);
$Self->AddOption(
Name => 'output-format',
Description => "Define output format - default is 'plain'.",
Required => 0,
HasValue => 1,
ValueRegex => qr/(json|plain|markdown|xml)/smx,
);
$Self->AddOption(
Name => 'output-columns',
Description => "Comma-separated output columns. Possible are login, email, customercompany, title, firstname, lastname, phone, fax, mobile, street, zip, city, country, comments, valid. Default are login and email.",
Required => 0,
HasValue => 1,
ValueRegex => qr/((login|email|customercompany|title|firstname|lastname|phone|fax|mobile|street|zip|city|country|comments|valid),?)*/smx,
);
return;
}
sub Run {
my ( $Self, %Param ) = @_;
$Self->Print("<yellow>Fetching customer users...</yellow>\n");
my $CustomerUserObject = $Kernel::OM->Get('Kernel::System::CustomerUser');
my %CustomerUserList = $CustomerUserObject->CustomerSearch(
Source => $Self->GetOption('source'),
);
$Self->Print("<green>Done.</green>\n");
return $Self->ExitCodeOk();
}
1;