Show all users via rt command line

I’m trying to get a list of all users in the system – both privileged, and non-privileged.

When I run the following command:

rt ls -t user

I only get the id numbers for the privileged users. Is there a command line switch to show non-privileged users?

Digging into the source code for /usr/bin/rt, I see in sub list:

$type is user in this case.

my $r = submit("$REST/search/$type", { query => $q, %data });
if ( $rawprint ) {
    print $r->content;
} else {
    my $forms = Form::parse($r->content);
    prettylist ($forms);
}
return 0;

So I guess now my question shifts to ‘why is the rest API only returning privileged users?, and how do I search for something else?’

I stumbled into your question while looking how to address the same issue.
I finally got it working like that:

rt list -t user -f id,name,realname,organization,country,emailaddress,privileged,disabled 'EmailAddress like %@example.com'

Under RT 4.4.3 it produced a list of privileged and unprivileged users, with only the fields I asked for (via the ‘-f’ option) filtered for the requested domain.

1 Like