'Aloha!
Below you see the text book example (from RT Essentials) using
DBIx::SearchBuilder to accessing the Tickets table from a stand alone perl
program.
Since I need restricting access to what a specific user would be allowed to
do, I think I have to transform this code into something using RT::Record
(or should it be RT::Ticket?)
Simply replacing DBIx::SearchBuilder with RT did not work. (well I sorta did
not expect that either..)
- and where do I feed it the username/password?
This must have been done a million times before, but google refuses to help
me :-(
Anyone?
--
/Morten %-)
#!/usr/bin/perl
use strict;
use warnings;
my $X = tkt->new;
$X->Load(123);
printf STDERR "%s: %s (%s)\n", $X->id, $X->Subject, $X->Status;
package tkt;
use strict;
use warnings;
use DBIx::SearchBuilder::Handle;
use base qw(DBIx::SearchBuilder::Record);
sub _Init
{
my $self = shift;
my $handle= DBIx::SearchBuilder::Handle->new;
$handle->Connect(Driver => 'mysql',
Database => 'rtdb',
User => 'rtuser',
Password => $ENV{RTDBPW});
$self->_Handle($handle);
$self->Table('Tickets');
}
sub _ClassAccessible
{
return { Id => {read => 1},
Status => {read => 1},
Subject => {read => 1}
};
}
_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]
Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com