[rt-users] Set user rights with scrip?

Bill Chever wchever at terracottatech.com
Mon Jun 19 17:37:50 EDT 2006


Alrighty then!

This is great information, Stephen.  Thanks!

Only one problem - The right I want to revoke is the "Let this user access
RT" right, not "Let this user be granted rights" which is what gets changed
by the SetPrivileged.  Is there a SetAccess equivalent? 

Bill
-----Original Message-----
From: Stephen Turner [mailto:sturner at MIT.EDU] 
Sent: Monday, June 19, 2006 1:29 PM
To: Bill Chever
Cc: rt-users at lists.bestpractical.com
Subject: RE: [rt-users] Set user rights with scrip?

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