[rt-users] Set user rights with scrip?

Stephen Turner sturner at MIT.EDU
Mon Jun 19 16:29:13 EDT 2006


At Monday 6/19/2006 03:46 PM, Bill Chever wrote:
>
>Steve,
>
>Thanks, but  "so you'll have to work with that object to pull out the
>individual requestors." is exactly what I am having trouble tracking down.
>How do I "work with the Group object" and where would it be documented as to
>what objects are actually available to me?
>
>Thanks for the answer!
>
>Bill

You can see the perl API docs with perldoc - assuming the $RTHOME/lib 
directory is in your perl library path, do:

perldoc RT::Ticket_Overlay

to see the methods in the Ticket object.

This should get you the Group's members in an RT::GroupMembers 
collection object:

my $requestors = $self->TicketObj->Requestors->MembersObj

Then to work with each requestor,

while (my $req = $requestors->Next) {
      my $req_principal = $req->MemberObj;
      if ($req_principal->IsUser) {
           $req_principal->Object->SetPrivileged(0);
      }
}

The variables above represent these kind of objects:

$requestors - RT::GroupMembers
$req - RT::GroupMember
$req_principal - RT::Principal

This seems cumbersome, and maybe there's a more streamlined way, but 
it should do what you want. The if statement may be unnecessary ( I 
think requestors are always users, not groups) but it doesn't hurt.

Steve 




More information about the rt-users mailing list