Scrips firing at will - huh?

Stephen Turner sturner@MIT.EDU writes:

I was wondering if moving the code to the ‘Custom action cleanup code’
section would solve the problem? You may also need to put “return 1;”
into the Custom action prep section.

Yes, it seems it does.

However, now I have another problem. The problem itself is mainly
cosmetic, but I’d like to understand what’s causing it.

In the action prep section I now have a check for “this ticket is
owned by Nobody” and also a check for
$self->TicketObj->CurrentUserHasRight(‘OwnTicket’).

The action cleanup section now contains:

my $ticket = $self->TicketObj;
my $Actor = $self->TransactionObj->CreatorObj->Id;

if ($ticket->CurrentUserHasRight(‘OwnTicket’)) { # Debug message
$RT::Logger->info(“The user seems to be allowed to own tickets”);
}

if ($Actor != $ticket->OwnerObj->Id) {
$RT::Logger->info(“Auto assign ticket #”. $ticket->id ." to user #". $Actor );

my ($status, $msg) = $ticket->SetOwner($Actor);
unless( $status ) {
   $RT::Logger->error("AutoTake error: $msg");
   return(undef);
}

}

Seems simple enough, but if a non-privileged user replies to an
unowned ticket I get the following in the log:

Dec 12 16:03:49 d116 RT: The user seems to be allowed to own tickets ((eval 449) :5)
Dec 12 16:03:49 d116 RT: Auto assign ticket #5 to user #28 ((eval 449):8)
Dec 12 16:03:49 d116 RT: AutoTake error: That user may not own tickets in that queue ((eval 449):12)

Why does $ticket->CurrentUserHasRight(‘OwnTicket’) return true for a
non-privileged user? Should I dig up the queue and call
CurrentUserHasRight() on that instead?

Leif Nixon - Systems expert
National Supercomputer Centre - Linkoping University

Stephen Turner sturner@MIT.EDU writes:

I was wondering if moving the code to the ‘Custom action cleanup code’
section would solve the problem? You may also need to put “return 1;”
into the Custom action prep section.

Yes, it seems it does.

However, now I have another problem. The problem itself is mainly
cosmetic, but I’d like to understand what’s causing it.

In the action prep section I now have a check for “this ticket is
owned by Nobody” and also a check for
$self->TicketObj->CurrentUserHasRight(‘OwnTicket’).

The action cleanup section now contains:

my $ticket = $self->TicketObj;
my $Actor = $self->TransactionObj->CreatorObj->Id;

if ($ticket->CurrentUserHasRight(‘OwnTicket’)) { # Debug message
$RT::Logger->info(“The user seems to be allowed to own tickets”);
}

if ($Actor != $ticket->OwnerObj->Id) {
$RT::Logger->info(“Auto assign ticket #”. $ticket->id ." to user #". $Actor );

my ($status, $msg) = $ticket->SetOwner($Actor);
unless( $status ) {
   $RT::Logger->error("AutoTake error: $msg");
   return(undef);
}

}

Seems simple enough, but if a non-privileged user replies to an
unowned ticket I get the following in the log:

Dec 12 16:03:49 d116 RT: The user seems to be allowed to own tickets ((eval 449) :5)
Dec 12 16:03:49 d116 RT: Auto assign ticket #5 to user #28 ((eval 449):8)
Dec 12 16:03:49 d116 RT: AutoTake error: That user may not own tickets in that queue ((eval 449):12)

Why does $ticket->CurrentUserHasRight(‘OwnTicket’) return true for a
non-privileged user? Should I dig up the queue and call
CurrentUserHasRight() on that instead?

Did you give non-privileged users the right to OwnTicket?

AFAIK $ticket->CurrentUser is $RT::SystemUser in scrips. It’s
described in WritingCustomScrips page on the wiki.On 12/12/05, Leif Nixon nixon@nsc.liu.se wrote:

Stephen Turner sturner@MIT.EDU writes:

I was wondering if moving the code to the ‘Custom action cleanup code’
section would solve the problem? You may also need to put “return 1;”
into the Custom action prep section.

Yes, it seems it does.

However, now I have another problem. The problem itself is mainly
cosmetic, but I’d like to understand what’s causing it.

In the action prep section I now have a check for “this ticket is
owned by Nobody” and also a check for
$self->TicketObj->CurrentUserHasRight(‘OwnTicket’).

The action cleanup section now contains:

my $ticket = $self->TicketObj;
my $Actor = $self->TransactionObj->CreatorObj->Id;

if ($ticket->CurrentUserHasRight(‘OwnTicket’)) { # Debug message
$RT::Logger->info(“The user seems to be allowed to own tickets”);
}

if ($Actor != $ticket->OwnerObj->Id) {
$RT::Logger->info(“Auto assign ticket #”. $ticket->id ." to user #". $Actor );

my ($status, $msg) = $ticket->SetOwner($Actor);
unless( $status ) {
   $RT::Logger->error("AutoTake error: $msg");
   return(undef);
}

}

Seems simple enough, but if a non-privileged user replies to an
unowned ticket I get the following in the log:

Dec 12 16:03:49 d116 RT: The user seems to be allowed to own tickets ((eval 449) :5)
Dec 12 16:03:49 d116 RT: Auto assign ticket #5 to user #28 ((eval 449):8)
Dec 12 16:03:49 d116 RT: AutoTake error: That user may not own tickets in that queue ((eval 449):12)

Why does $ticket->CurrentUserHasRight(‘OwnTicket’) return true for a
non-privileged user? Should I dig up the queue and call
CurrentUserHasRight() on that instead?


Leif Nixon - Systems expert

National Supercomputer Centre - Linkoping University


The rt-users Archives

Be sure to check out the RT Wiki at http://wiki.bestpractical.com

Download a free sample chapter of RT Essentials from O’Reilly Media at http://rtbook.bestpractical.com

WE’RE COMING TO YOUR TOWN SOON - RT Training in Amsterdam, Boston and
San Francisco - Find out more at http://bestpractical.com/services/training.html

Best regards, Ruslan.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Greetings Leif!

Leif Nixon wrote:

Now the strange thing: If a user clicks one of the “Reply” links in
the history of an unowned ticket (on the ordinary Ticket/Display.html
page), he gets a notification from the Owner Change scrip that he is
now the owner of the ticket. Note that this is when he just clicks the
“Reply” link, before he has actually entered a reply and updated the
ticket!

Furthermore, if you at this point cancel the reply and return to the
ticket display, it turns out that the ticket still is ownerless. It
has in fact not been assigned to the user, but still the Owner
Change scrip fired.

Could someone spread some light on this?

I have some troubles with “reply” button before. I used myISAM tables
and got empty transaction right after pressing this button. This issue
fixed by using InnoDB.

Regarding your issue: when pressing “reply” button, RT is creating empty
transaction (I belive it is for some test), then it rollbacks it. (So,
when I used MyIsam, I got empty transaction - myisam supports no
rollback). It appears to me, that when it creates test transaction - you
scrip got executed. It triggers owner change sctip. It posts email…
Than, RT executes rollback and ticket is ownerless again.

Just a guess… May be helpfull.

SY, Danial.


Danial Klimkin,
Falk eSolutions AG Russia
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDnZqg2ce6OqXQ52QRAgcAAJ9m2mIasneGe0PNC/bqQm50jhGgSQCfakKi
Ap3LvTRgwrLsKwiUAxwJwwo=
=v51j
-----END PGP SIGNATURE-----

Ruslan Zakirov ruslan.zakirov@gmail.com writes:

AFAIK $ticket->CurrentUser is $RT::SystemUser in scrips. It’s
described in WritingCustomScrips page on the wiki.

Argh. That would explain it, yes. Thanks!

Leif Nixon - Systems expert
National Supercomputer Centre - Linkoping University

TO list,

Silly question from someone who has used RT for so many years. I have
noticed that the ticket comments that I put into a template for an email
doesn’t wrap or wraps waaaaaaaay out there. What can I do to make it wrap
within, lets say, 60 characters?

Thanks.

Kenn
LBNL

Silly question from someone who has used RT for so many years. I have noticed that the ticket
comments that I put into a template for an email doesn’t wrap or wraps waaaaaaaay out there.
What can I do to make it wrap within, lets say, 60 characters?

Hit return when editing, rather than letting it wrap at the edge of
the box. There are configuration options to change that on ticket
update/create but not on Template editing.

-kevin

Kevin,

This is the code in the template:

Resolution Comment:
{$Ticket->FirstCustomFieldValue(‘Resolution Description’);}

The Custom Field type is “Fill in one wiki text”.

When I’m typing in that Custom Field, I don’t usually hit return in the
middle of a sentence.

Any ideas? A Configuration setting, perhaps?

Kenn
LBNLOn Tue, Aug 9, 2011 at 2:13 PM, Kevin Falcone falcone@bestpractical.comwrote:

On Tue, Aug 09, 2011 at 12:03:05PM -0700, Kenneth Crocker wrote:

Silly question from someone who has used RT for so many years. I have
noticed that the ticket
comments that I put into a template for an email doesn’t wrap or wraps
waaaaaaaay out there.
What can I do to make it wrap within, lets say, 60 characters?

Hit return when editing, rather than letting it wrap at the edge of
the box. There are configuration options to change that on ticket
update/create but not on Template editing.

-kevin


RT Training Sessions (http://bestpractical.com/services/training.html)

  • Chicago, IL, USA — September 26 & 27, 2011
  • San Francisco, CA, USA — October 18 & 19, 2011
  • Washington DC, USA — October 31 & November 1, 2011
  • Melbourne VIC, Australia — November 28 & 29, 2011
  • Barcelona, Spain — November 28 & 29, 2011

Kevin,

This is the code in the template:

Your question implied you were writing text in the template.

Resolution Comment:
{$Ticket->FirstCustomFieldValue(‘Resolution Description’);}

The Custom Field type is “Fill in one wiki text”.

When I’m typing in that Custom Field, I don’t usually hit return in the middle of a sentence.

Hitting return would fix it.

Any ideas? A Configuration setting, perhaps?

You’ll need to wrap the text. There are perl modules for this, however,
most mail readers wrap text, and RT wraps text in the ticket history.

-kevin

Kevin,

Yes, RT does wrap in history. However, when I click “Show” for the outgoing
email, I see this run-on text line and that kinda made me wonder what the
user was getting. I should probably just go to the guy and ask him to bring
up the email.

Thanks.

Kenn
LBNLOn Tue, Aug 9, 2011 at 3:53 PM, Kevin Falcone falcone@bestpractical.comwrote:

On Tue, Aug 09, 2011 at 03:25:46PM -0700, Kenneth Crocker wrote:

Kevin,

This is the code in the template:

Your question implied you were writing text in the template.

Resolution Comment:
{$Ticket->FirstCustomFieldValue(‘Resolution Description’);}

The Custom Field type is “Fill in one wiki text”.

When I’m typing in that Custom Field, I don’t usually hit return in
the middle of a sentence.

Hitting return would fix it.

Any ideas? A Configuration setting, perhaps?

You’ll need to wrap the text. There are perl modules for this, however,
most mail readers wrap text, and RT wraps text in the ticket history.

-kevin


RT Training Sessions (http://bestpractical.com/services/training.html)

  • Chicago, IL, USA — September 26 & 27, 2011
  • San Francisco, CA, USA — October 18 & 19, 2011
  • Washington DC, USA — October 31 & November 1, 2011
  • Melbourne VIC, Australia — November 28 & 29, 2011
  • Barcelona, Spain — November 28 & 29, 2011

Yes, RT does wrap in history. However, when I click “Show” for the outgoing email, I see this
run-on text line and that kinda made me wonder what the user was getting. I should probably
just go to the guy and ask him to bring up the email.

If you’re concerned, that’s the easiest way to find out what it looks
like.

-kevin

To list,

It is as I expected. Both the body of the actual email and what shows in RT
history (hitting the “Show” button for outgoing email) have the text strung
out to the right for about 150 characters with no wrap.

I’m sure I’ve got a configuration setting wrong. Which setting in the config
file controls this?

Thanks.

Kenn
LBNLOn Wed, Aug 10, 2011 at 10:37 AM, Kevin Falcone falcone@bestpractical.comwrote:

On Wed, Aug 10, 2011 at 10:15:16AM -0700, Kenneth Crocker wrote:

Yes, RT does wrap in history. However, when I click “Show” for the
outgoing email, I see this
run-on text line and that kinda made me wonder what the user was
getting. I should probably
just go to the guy and ask him to bring up the email.

If you’re concerned, that’s the easiest way to find out what it looks
like.

-kevin


RT Training Sessions (http://bestpractical.com/services/training.html)

  • Chicago, IL, USA — September 26 & 27, 2011
  • San Francisco, CA, USA — October 18 & 19, 2011
  • Washington DC, USA — October 31 & November 1, 2011
  • Melbourne VIC, Australia — November 28 & 29, 2011
  • Barcelona, Spain — November 28 & 29, 2011

To list,

It is as I expected. Both the body of the actual email and what shows in RT history (hitting
the “Show” button for outgoing email) have the text strung out to the right for about 150
characters with no wrap.

I’m sure I’ve got a configuration setting wrong. Which setting in the config file controls
this?

Kenn

There is no config to control the wrapping of a wikitext CF that you
load in a template and add to the outgoing email. There are configs
to control the wrapping of content you type into the editor.

-kevin

KEvin,

You mean a config setting for how the text wraps in the CF when I type it
in? If so, which one?

Thanks.

Kenn
LBNLOn Fri, Aug 12, 2011 at 12:40 PM, Kevin Falcone falcone@bestpractical.comwrote:

On Fri, Aug 12, 2011 at 12:24:01PM -0700, Kenneth Crocker wrote:

To list,

It is as I expected. Both the body of the actual email and what shows
in RT history (hitting
the “Show” button for outgoing email) have the text strung out to the
right for about 150
characters with no wrap.

I’m sure I’ve got a configuration setting wrong. Which setting in the
config file controls
this?

Kenn

There is no config to control the wrapping of a wikitext CF that you
load in a template and add to the outgoing email. There are configs
to control the wrapping of content you type into the editor.

-kevin

On Wed, Aug 10, 2011 at 10:37 AM, Kevin Falcone <[1] falcone@bestpractical.com> wrote:

 On Wed, Aug 10, 2011 at 10:15:16AM -0700, Kenneth Crocker wrote:
 > Yes, RT does wrap in history. However, when I click "Show" for the

outgoing email, I see

 this
 > run-on text line and that kinda made me wonder what the user was

getting. I should

 probably
 > just go to the guy and ask him to bring up the email.

 If you're concerned, that's the easiest way to find out what it

looks

 like.
 -kevin
 --------
 RT Training Sessions ([2]

http://bestpractical.com/services/training.html)

 * Chicago, IL, USA * September 26 & 27, 2011
 * San Francisco, CA, USA * October 18 & 19, 2011
 * Washington DC, USA * October 31 & November 1, 2011
 * Melbourne VIC, Australia * November 28 & 29, 2011
 * Barcelona, Spain * November 28 & 29, 2011

References

Visible links

  1. mailto:falcone@bestpractical.com
  2. http://bestpractical.com/services/training.html

RT Training Sessions (http://bestpractical.com/services/training.html)

  • Chicago, IL, USA ? September 26 & 27, 2011
  • San Francisco, CA, USA ? October 18 & 19, 2011
  • Washington DC, USA ? October 31 & November 1, 2011
  • Melbourne VIC, Australia ? November 28 & 29, 2011
  • Barcelona, Spain ? November 28 & 29, 2011

RT Training Sessions (http://bestpractical.com/services/training.html)

  • Chicago, IL, USA — September 26 & 27, 2011
  • San Francisco, CA, USA — October 18 & 19, 2011
  • Washington DC, USA — October 31 & November 1, 2011
  • Melbourne VIC, Australia — November 28 & 29, 2011
  • Barcelona, Spain — November 28 & 29, 2011