[rt-users] RT 4.08 Account creation

John Johnston johnj at msu.edu
Tue Nov 27 13:30:41 EST 2012


Thanks Kevin,

We've been using the REST API for creating the tickets.  We assign 
certain critical variables using the values returned by Shibboleth 
authentication first:

my $your_netid = $ENV{'REMOTE_USER'};
my $your_full_name = $ENV{'displayName'};
my $your_phone = $query->param("PHONE");
my $your_subject = $query->param("SUBJECT");
my $your_comments = $query->param("COMMENTS");
my $your_public = $query->param("PUBLIC");

Set the server and then login using an authorized admin user:

my $rt = RT::Client::REST->new(
     server  => ($ENV{RTSERVER} || 'http://our.domain.com'),
     );

     $rt->login(
     username=> "adminusername",
     password=> "adminpassword",
     );

Then create the ticket.

my $ticket = RT::Client::REST::Ticket->new(
         rt  => $rt,
         queue   => "General",
         subject => "$your_subject",
         requestor => [$your_netid],
         cf => {
                 'public' => $your_public,
             },
     )->store(text => "$your_comments");

my $newticket =  $ticket->id;

To elaborate on the forms further, they were created by someone no 
longer with our organization, and modifications were not well documented 
(if at all).  The action on our old RT instance was as the "netid" was 
passed into RT, the account (if it did not already exist), was created 
with the username and email set to the netid. When these forms were 
moved to the new RT instance, everything was pretty much the same, 
except that the email address field was not filled in.  To work around 
this problem, we tried adding this code using bin/RT:

my $clean_email = $ENV{'mail'};
$clean_email =~ s/\@/\\@/g;
$result = `/opt/rt4/bin/rt create -t user add Name=$your_netid 
EmailAddress=$clean_email `;

As I said previously, if you "hard code" in an email for $clean_email, 
it works every time as one would expect.  If not, and you pass in the 
shib variable as shown above, it fails.

Thanks for any input.

John

On 11/27/12 12:25 PM, Kevin Falcone wrote:
> On Wed, Nov 21, 2012 at 01:24:11PM -0500, John Johnston wrote:
>>     I've installed RT 4.0.8 on a RHEL 6.2 system and overall it's working fine with one notable
>>     exception.  We authenticate users with Shibboleth, and once so authenticated they are able to
>>     create tickets.  First time users have their accounts auto-created.  We had a previous
>>     instance of RT 3.0.7 and used perl-based forms for ticket creation.  Auto-creation of accounts
>>     worked fine, with the displayname, email, and userid returned from Shibboleth and passed to
>>     RT.  However, these same forms when used on RT 4.0.8 while they *do* create the account if it
>>     doesn't exist, and it does set the "Name" to the email address, the "EmailAddress" itself and
>>     "RealName" are left blank.
> How do your forms create tickets/accounts?  Using bin/rt or sending
> mail as the user or something else?  I can see what you've done with
> testing, but knowing how they normally work is helpful.
>
> Unfortunately, without some logs, or a clearer sense of exactly what
> runs during the non-debugging form, it's hard to guess at what is
> going on.
>
> -kevin
>
>>     This means that users cannot get email on their tickets (confirmatory or otherwise), unless an
>>     administrator goes in, selects the account, and manually adds the email address.  I've tried
>>     several workarounds, including doing a mysql query to see if the account exists, and if not,
>>     to create it using an RT CLI command encased in backticks.  This is contained in our "contact"
>>     ticket creation form.  I've experimented with several options, including escaping the "@" in
>>     the email address.  Recently, I used Encode to ensure the values obtained from Shibboleth were
>>     converted into UTF-8 before being passed to the RT CLI command, and this *sort of* worked.
>>     Interestingly, it added the account but dropped the letter "e" from the mymail.edu address (to
>>     leave mymail.du).  Also interesting, is if I bypass the Shibboleth values and hard code in an
>>     email address like:
>>
>>     my $clean_email = [1]"skippy at mailme.edu"
>>
>>     And pass it to the RT CLI command like:
>>
>>     $result = `/opt/rt4/bin/rt create -t user add Name=$your_netid EmailAddress=$clean_email `;
>>
>>     ...again, it works fine.
>>
>>     I've been banging my head on this for awhile.  Any insights would be appreciated.
>>
>>
>> --------
>> We're hiring! http://bestpractical.com/jobs

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20121127/d23b6236/attachment.htm>


More information about the rt-users mailing list