Custom Scrip Failing (using example from RT Essentials) and User Details not accessible

One of the biggest complaints from my privileged users during our testing of RT is that the requestor’s phone number is not presented to them conveniently. We currently handle the bulk of our support by phone, so some of them are standing at my office door with torches and pitchforks.

To rectify this I am trying to implement the custom scrip found on page 81 of the RT Essentials book, and customize it to pull up phone numbers instead of departments.

The customized scrip is:

1 my $email = ($self->TicketObj->RequestorAddresses)[0];
2
3 my $ldap = Net::LDAP->new( ‘someserver.umanitoba.ca’ );
4 $ldap->bind;
5
6 my $msg = $ldap->search( base => ‘o="University of Manitoba,c=“ca”’,
7 filter => “(mail=$email)”,
8 );
9
10 my $entry = $msg->entry(0);
11
12 my $phone= $entry->get_value(‘telephoneNumber’);
13
14 my $cf = RT::CustomField->new( $RT::SystemUser );
15 $cf->LoadByName( Name => ‘RequestorPhone’ );
16
17 $self->TicketObj->AddCustomFieldValue( Field => $cf, Value => $phone);
18
19 return 1;

Changes from the original are
3 Server
6 Base
7 email -> mail (what our non-standard ldap calls it)
12 $dept -> $phone
15 my custom field
17 $dept -> $phone

The custom field RequestorPhone is not being set, though. RT’s debug log shows the entry:

[error]: Scrip 16 Prepare failed: Can’t call method “get_value” on an undefined value at (eval 8643) line 12.

Could someone help me get this working, or share what they have done?

Secondly, I am having an issue that when my privileged users click on a requestor in the people tab of a ticket, they are presented with:

"Time to display: 0.009515

»|« RT 3.8.4 Copyright 1996-2009 Best Practical Solutions, LLC."

Root/Superuser is taken to the requestor’s details.

So right now, my people have no way to obtain the requestor’s phone number from within RT. So what are they doing is falling back to our old helpdesk system and in frustration entering the calls there. This is jeopardizing the acceptance and adoption of RT as a replacement for our old system.

I’m sure that I’ve made one or two (or more) simple errors and wish I could spend more time looking into this before going to the forum, but the townspeople are at the castle gates.

TIA,

Mike

Mike,

I understand your frustration. I’m not familiar with that scrip, nor do
I usually write scrips that go against the USER Table. However, I was
thinking about how I would do it and I would want to try something that
captures the Requesors phone number at the time the ticket is created
and stuff it into a Custom Field. That way whenever the ticket is looked
at, the phone number could be displayed. An alternative of that would be
to modify the ticket display code (make a local copy of
/share/html/Ticket/Display.html) to display the Requestors phone when
accessed. That way you would always get the current Requestor (in case
it was changed after creation). I’m not sure, but if there is a
$Self->TransactionObj and a $Self->TicketObj then perhaps there is also
a $Self->UserObj that would allow you to get to the Users phone.
Perhaps there is someone out there that can pass on any of that kind of
knowledge.

Kenn
LBNLOn 8/5/2009 10:31 PM, Michael Ellis wrote:

One of the biggest complaints from my privileged users during our
testing of RT is that the requestor’s phone number is not presented to
them conveniently. We currently handle the bulk of our support by
phone, so some of them are standing at my office door with torches and
pitchforks.

To rectify this I am trying to implement the custom scrip found on
page 81 of the RT Essentials book, and customize it to pull up phone
numbers instead of departments.

The customized scrip is:

1 my $email = ($self->TicketObj->RequestorAddresses)[0];
2
3 my $ldap = Net::LDAP->new( ‘someserver.umanitoba.ca’ );
4 $ldap->bind;
5
6 my $msg = $ldap->search( base => ‘o="University of
Manitoba,c=“ca”’,
7 filter => “(mail=$email)”,
8 );
9
10 my $entry = $msg->entry(0);
11
12 my $phone= $entry->get_value(‘telephoneNumber’);
13
14 my $cf = RT::CustomField->new( $RT::SystemUser );
15 $cf->LoadByName( Name => ‘RequestorPhone’ );
16
17 $self->TicketObj->AddCustomFieldValue( Field => $cf, Value =>
$phone);
18
19 return 1;

Changes from the original are
3 Server
6 Base
7 email -> mail (what our non-standard ldap calls it)
12 $dept -> $phone
15 my custom field
17 $dept -> $phone

The custom field RequestorPhone is not being set, though. RT’s debug
log shows the entry:

[error]: Scrip 16 Prepare failed: Can’t call method “get_value” on an
undefined value at (eval 8643) line 12.

Could someone help me get this working, or share what they have done?

Secondly, I am having an issue that when my privileged users click on
a requestor in the people tab of a ticket, they are presented with:

"Time to display: 0.009515

�|� RT 3.8.4 Copyright 1996-2009 Best Practical Solutions, LLC."

Root/Superuser is taken to the requestor’s details.

So right now, my people have no way to obtain the requestor’s phone
number from within RT. So what are they doing is falling back to our
old helpdesk system and in frustration entering the calls there. This
is jeopardizing the acceptance and adoption of RT as a replacement for
our old system.

I’m sure that I’ve made one or two (or more) simple errors and wish I
could spend more time looking into this before going to the forum, but
the townspeople are at the castle gates.

TIA,

Mike


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

I strongly recommend storing this information in the requestor, and
then pulling it from there,
as Ken suggest. We use REST to create tickets, and create the
requestor with such details
before hand, but I’ve written a scrip to extract such information from
a vCard, which could be
of use: http://wiki.bestpractical.com/view/OnCreateSetUserDetails

For the record, what you want to use to display the number are probably:

$Ticket->Requestors->UserMembersObj->First->HomePhone();
$Ticket->Requestors->UserMembersObj->First->WorkPhone();
$Ticket->Requestors->UserMembersObj->First->MobilePhone();

Cambridge Energy Alliance: Save money. Save the planet.

Thanks Jerrad & Ken,

After I posted last night I came accross this idea, although, I was trying
to work with /opt/rt3/local/html/Elements/ShowRequestor. I was lost on what
code to add. I’ll try the lines you suggested in your follow up email,
Jerrad:

$Ticket->Requestors->UserMembersObj->First->HomePhone();
$Ticket->Requestors->UserMembersObj->First->WorkPhone();
$Ticket->Requestors->UserMembersObj->First->MobilePhone();

Any idea why no one but root can view the modifyuser pages? I’ve given our
helpdesk group AdminUsers right.

Thanks so much,

MikeFrom: “Jerrad Pierce” jpierce@cambridgeenergyalliance.org
Sent: Thursday, August 06, 2009 11:49 AM
To: “Ken Crocker” kfcrocker@lbl.gov
Cc: “Michael Ellis” michael_ellis@umanitoba.ca; "RT-USERS"
RT-Users@lists.bestpractical.com
Subject: Re: [rt-users] Custom Scrip Failing (using example from RT
Essentials) and User Details not accessible

I strongly recommend storing this information in the requestor, and
then pulling it from there,
as Ken suggest. We use REST to create tickets, and create the
requestor with such details
before hand, but I’ve written a scrip to extract such information from
a vCard, which could be
of use: http://wiki.bestpractical.com/view/OnCreateSetUserDetails

Mike,

If your talking about looking at User info via WebUI, then I’d take a
look at the privileges you’ve set up. As “SuperUser” (we have only
allowed 2 in our system) I can pretty much do what I want as the Admin
of our RT installation.

Kenn
LBNLOn 8/6/2009 10:18 AM, Michael Ellis wrote:

Thanks Jerrad & Ken,

After I posted last night I came accross this idea, although, I was
trying to work with /opt/rt3/local/html/Elements/ShowRequestor. I was
lost on what code to add. I’ll try the lines you suggested in your
follow up email, Jerrad:

$Ticket->Requestors->UserMembersObj->First->HomePhone();
$Ticket->Requestors->UserMembersObj->First->WorkPhone();
$Ticket->Requestors->UserMembersObj->First->MobilePhone();

Any idea why no one but root can view the modifyuser pages? I’ve given
our helpdesk group AdminUsers right.

Thanks so much,

Mike


From: “Jerrad Pierce” jpierce@cambridgeenergyalliance.org
Sent: Thursday, August 06, 2009 11:49 AM
To: “Ken Crocker” kfcrocker@lbl.gov
Cc: “Michael Ellis” michael_ellis@umanitoba.ca; "RT-USERS"
RT-Users@lists.bestpractical.com
Subject: Re: [rt-users] Custom Scrip Failing (using example from RT
Essentials) and User Details not accessible

I strongly recommend storing this information in the requestor, and
then pulling it from there,
as Ken suggest. We use REST to create tickets, and create the
requestor with such details
before hand, but I’ve written a scrip to extract such information from
a vCard, which could be
of use: http://wiki.bestpractical.com/view/OnCreateSetUserDetails

Any idea why no one but root can view the modifyuser pages? I’ve given our
helpdesk group AdminUsers right.
Nope. I only have Admin Users and am able to do so just fine.
But Johnathan Bell was having similar ACL issues recently.

Cambridge Energy Alliance: Save money. Save the planet.

Ken, all,

Thanks, I did mean the WebUI. SuperUser can see that page, no one else can.

I thought it would be a privilege, too. The only seemingly relevant
privilege I could find was “AdminUser” but granting it did not resolve the
issue. The url for the malformed page is:

http://rt.somewhere.com/Admin/Users/Modify.html?id=XYZ

…and the resultant page contains nothing but:

"Time to display: 0.007461

�|� RT 3.8.4 Copyright 1996-2009 Best Practical Solutions, LLC."

-MikeFrom: “Ken Crocker” kfcrocker@lbl.gov
Sent: Thursday, August 06, 2009 12:23 PM
To: “Michael Ellis” michael_ellis@umanitoba.ca
Cc: “Jerrad Pierce” jpierce@cambridgeenergyalliance.org; "RT-USERS"
RT-Users@lists.bestpractical.com
Subject: Re: [rt-users] Custom Scrip Failing (using example from RT
Essentials) and User Details not accessible

Mike,

If your talking about looking at User info via WebUI, then I’d take a look
at the privileges you’ve set up. As “SuperUser” (we have only allowed 2 in
our system) I can pretty much do what I want as the Admin of our RT
installation.

Kenn
LBNL

Thanks Jerrad & Ken,

After I posted last night I came accross this idea, although, I was
trying to work with /opt/rt3/local/html/Elements/ShowRequestor. I was
lost on what code to add. I’ll try the lines you suggested in your follow
up email, Jerrad:

$Ticket->Requestors->UserMembersObj->First->HomePhone();
$Ticket->Requestors->UserMembersObj->First->WorkPhone();
$Ticket->Requestors->UserMembersObj->First->MobilePhone();

Any idea why no one but root can view the modifyuser pages? I’ve given
our helpdesk group AdminUsers right.

Thanks so much,

Mike


From: “Jerrad Pierce” jpierce@cambridgeenergyalliance.org
Sent: Thursday, August 06, 2009 11:49 AM
To: “Ken Crocker” kfcrocker@lbl.gov
Cc: “Michael Ellis” michael_ellis@umanitoba.ca; "RT-USERS"
RT-Users@lists.bestpractical.com
Subject: Re: [rt-users] Custom Scrip Failing (using example from RT
Essentials) and User Details not accessible

I strongly recommend storing this information in the requestor, and
then pulling it from there,
as Ken suggest. We use REST to create tickets, and create the
requestor with such details
before hand, but I’ve written a scrip to extract such information from
a vCard, which could be
of use: http://wiki.bestpractical.com/view/OnCreateSetUserDetails

Ken, all,

Thanks, I did mean the WebUI. SuperUser can see that page, no one else can.

I thought it would be a privilege, too. The only seemingly relevant
privilege I could find was “AdminUser” but granting it did not resolve the
issue. The url for the malformed page is:

http://rt.somewhere.com/Admin/Users/Modify.html?id=XYZ

…and the resultant page contains nothing but:

"Time to display: 0.007461

�|� RT 3.8.4 Copyright 1996-2009 Best Practical Solutions, LLC."

There is an autohandler in Admin/ that requires users have
ShowConfigTab granted to access anything in Admin/

It was implemented as part of the security fixes between 3.8.3 and
3.8.4 to lock down access to the Admin UI.

It may honestly be easier to make a local copy of ShowRequestor and
munge it to show more info in a readonly fashion, rather than letting
your users change data about other users.

Please note that depending on what user info you’re printing, you may
need to tell RT that it is ok to share the info. RT considers phone
numbers privateish data and you may need to tweak the Accessible
routine.

-kevin

Although there might be better ways of doing this, the reason this scrip wasn’t working is simply some wrongly placed quote marks in like 6. Fixed and it works. That’s what I get for trying to work at after midnight.

-MikeFrom: Michael Ellis
Sent: Thursday, August 06, 2009 12:31 AM
To: RT-USERS
Subject: [rt-users] Custom Scrip Failing (using example from RT Essentials)and User Details not accessible

One of the biggest complaints from my privileged users during our testing of RT is that the requestor’s phone number is not presented to them conveniently. We currently handle the bulk of our support by phone, so some of them are standing at my office door with torches and pitchforks.

To rectify this I am trying to implement the custom scrip found on page 81 of the RT Essentials book, and customize it to pull up phone numbers instead of departments.

The customized scrip is:

1 my $email = ($self->TicketObj->RequestorAddresses)[0];
2
3 my $ldap = Net::LDAP->new( ‘someserver.umanitoba.ca’ );
4 $ldap->bind;
5
6 my $msg = $ldap->search( base => ‘o="University of Manitoba,c=“ca”’,
7 filter => “(mail=$email)”,
8 );
9
10 my $entry = $msg->entry(0);
11
12 my $phone= $entry->get_value(‘telephoneNumber’);
13
14 my $cf = RT::CustomField->new( $RT::SystemUser );
15 $cf->LoadByName( Name => ‘RequestorPhone’ );
16
17 $self->TicketObj->AddCustomFieldValue( Field => $cf, Value => $phone);
18
19 return 1;

Changes from the original are
3 Server
6 Base
7 email -> mail (what our non-standard ldap calls it)
12 $dept -> $phone
15 my custom field
17 $dept -> $phone

The custom field RequestorPhone is not being set, though. RT’s debug log shows the entry:

[error]: Scrip 16 Prepare failed: Can’t call method “get_value” on an undefined value at (eval 8643) line 12.

Could someone help me get this working, or share what they have done?

Secondly, I am having an issue that when my privileged users click on a requestor in the people tab of a ticket, they are presented with:

"Time to display: 0.009515

»|« RT 3.8.4 Copyright 1996-2009 Best Practical Solutions, LLC."

Root/Superuser is taken to the requestor’s details.

So right now, my people have no way to obtain the requestor’s phone number from within RT. So what are they doing is falling back to our old helpdesk system and in frustration entering the calls there. This is jeopardizing the acceptance and adoption of RT as a replacement for our old system.

I’m sure that I’ve made one or two (or more) simple errors and wish I could spend more time looking into this before going to the forum, but the townspeople are at the castle gates.

TIA,

Mike

http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Mike,

In addition to that, you might want to explore the “ModifySelf” right.
We grant it Globally to “Privileged” Users.

Kenn
LBNLOn 8/6/2009 11:10 AM, Kevin Falcone wrote:

On Thu, Aug 06, 2009 at 12:32:08PM -0500, Michael Ellis wrote:

Ken, all,

Thanks, I did mean the WebUI. SuperUser can see that page, no one else can.

I thought it would be a privilege, too. The only seemingly relevant
privilege I could find was “AdminUser” but granting it did not resolve the
issue. The url for the malformed page is:

http://rt.somewhere.com/Admin/Users/Modify.html?id=XYZ

…and the resultant page contains nothing but:

"Time to display: 0.007461

�|� RT 3.8.4 Copyright 1996-2009 Best Practical Solutions, LLC."

There is an autohandler in Admin/ that requires users have
ShowConfigTab granted to access anything in Admin/

It was implemented as part of the security fixes between 3.8.3 and
3.8.4 to lock down access to the Admin UI.

It may honestly be easier to make a local copy of ShowRequestor and
munge it to show more info in a readonly fashion, rather than letting
your users change data about other users.

Please note that depending on what user info you’re printing, you may
need to tell RT that it is ok to share the info. RT considers phone
numbers privateish data and you may need to tweak the Accessible
routine.

-kevin


From: “Ken Crocker” kfcrocker@lbl.gov
Sent: Thursday, August 06, 2009 12:23 PM
To: “Michael Ellis” michael_ellis@umanitoba.ca
Cc: “Jerrad Pierce” jpierce@cambridgeenergyalliance.org; "RT-USERS"
RT-Users@lists.bestpractical.com
Subject: Re: [rt-users] Custom Scrip Failing (using example from RT
Essentials) and User Details not accessible

Mike,

If your talking about looking at User info via WebUI, then I’d take a look
at the privileges you’ve set up. As “SuperUser” (we have only allowed 2 in
our system) I can pretty much do what I want as the Admin of our RT
installation.

Kenn
LBNL

On 8/6/2009 10:18 AM, Michael Ellis wrote:

Thanks Jerrad & Ken,

After I posted last night I came accross this idea, although, I was
trying to work with /opt/rt3/local/html/Elements/ShowRequestor. I was
lost on what code to add. I’ll try the lines you suggested in your follow
up email, Jerrad:

$Ticket->Requestors->UserMembersObj->First->HomePhone();
$Ticket->Requestors->UserMembersObj->First->WorkPhone();
$Ticket->Requestors->UserMembersObj->First->MobilePhone();

Any idea why no one but root can view the modifyuser pages? I’ve given
our helpdesk group AdminUsers right.

Thanks so much,

Mike


From: “Jerrad Pierce” jpierce@cambridgeenergyalliance.org
Sent: Thursday, August 06, 2009 11:49 AM
To: “Ken Crocker” kfcrocker@lbl.gov
Cc: “Michael Ellis” michael_ellis@umanitoba.ca; "RT-USERS"
RT-Users@lists.bestpractical.com
Subject: Re: [rt-users] Custom Scrip Failing (using example from RT
Essentials) and User Details not accessible

I strongly recommend storing this information in the requestor, and
then pulling it from there,
as Ken suggest. We use REST to create tickets, and create the
requestor with such details
before hand, but I’ve written a scrip to extract such information from
a vCard, which could be
of use: http://wiki.bestpractical.com/view/OnCreateSetUserDetails


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com