'Aloha!<br><br>Below you see the text book example (from RT Essentials) using DBIx::SearchBuilder to accessing the Tickets table from a stand alone perl program.<br>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?)<br>
<br>Simply replacing DBIx::SearchBuilder with RT did not work. (well I sorta did not expect that either..)<br> - and where do I feed it the username/password?<br><br>This must have been done a million times before, but google refuses to help me :-(<br>
<br>Anyone?<br><br>-- <br>/Morten %-)<br><br><br>#!/usr/bin/perl<br>use strict;<br>use warnings;<br><br>my $X = tkt->new;<br>$X->Load(123);<br>printf STDERR "%s: %s (%s)\n", $X->id, $X->Subject, $X->Status;<br>
<br>package tkt;<br>use strict;<br>use warnings;<br>use DBIx::SearchBuilder::Handle;<br>use base qw(DBIx::SearchBuilder::Record);<br><br>sub _Init<br>{<br> my $self = shift;<br> my $handle= DBIx::SearchBuilder::Handle->new;<br>
$handle->Connect(Driver => 'mysql',<br> Database => 'rtdb',<br> User => 'rtuser',<br> Password => $ENV{RTDBPW});<br> $self->_Handle($handle);<br>
$self->Table('Tickets');<br>}<br><br>sub _ClassAccessible<br>{<br> return { Id => {read => 1},<br> Status => {read => 1},<br> Subject => {read => 1}<br> };<br>
}<br><br>