<div dir="ltr">oops.. sorry for posting twice. I thought it did not make it to the ML first time</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, May 14, 2013 at 9:28 PM, Asif Iqbal <span dir="ltr"><<a href="mailto:vadud3@gmail.com" target="_blank">vadud3@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>I am trying to add a list of UIDs into one of my group and it is failing.</div><div><br></div><div>

I am running the script that was posted with this subject on Nov 22, 2010 by tanhuy.langloy at bt. I am running it on RT 3.8.2</div>
<div><br></div><div>#!/usr/bin/perl</div><div><div># Utilisation : ./<a href="http://rtgroupmember.pl" target="_blank">rtgroupmember.pl</a> GROUPNAME </div><div># Attention : Le fichier list.txt doit être correctement rempli </div>


<div><br></div></div><div class="im"><div>use strict;</div><div>use lib "/opt/rt3/lib";</div><div><br></div><div>use RT;</div></div><div>use RT::User;</div><div>use RT::Interface::CLI;</div><div><br></div><div>

RT::LoadConfig();</div>
<div>RT::Init();</div><div><br></div><div>my $user = new RT::User($RT::SystemUser); </div><div>my $group = new RT::Group($RT::SystemUser); </div><div class="im"><div>my $inputgroup = $ARGV[0]; </div><div><br></div><div>$group->LoadUserDefinedGroup( $inputgroup );</div>


<div><br></div></div><div>open FILE, "usernames.txt" or die $!;</div><div class="im"><div><br></div><div>while (<FILE>)</div><div>{</div><div>  $user->Load( $_ );</div><div>  $group->AddMember( $user->PrincipalObj->Id );</div>


</div><div>  #print $user->PrincipalObj->Id ."\n"; </div><div class="im"><div>}</div><div><br></div><div>close FILE;</div><div><br></div><div><br></div><div><div>$ ./<a href="http://rtgroupmember.pl" target="_blank">rtgroupmember.pl</a> MYGROUP<br>


</div></div><div><br></div></div><div><div>[Wed May 15 01:23:15 2013] [error]: Couldn't get principal for not loaded object (/opt/rt3/lib/RT/User_Overlay.pm:1154)</div><div>[Wed May 15 01:23:15 2013] [crit]: Can't call method "Id" on an undefined value at ./<a href="http://rtgroupmember.pl" target="_blank">rtgroupmember.pl</a> line 26, <FILE> line 1. (/opt/rt3/lib/RT.pm:377)</div>


<div>Can't call method "Id" on an undefined value at ./<a href="http://rtgroupmember.pl" target="_blank">rtgroupmember.pl</a> line 26, <FILE> line 1</div></div><div><br></div><div>Any suggestion would be appreciated</div>


<div><br></div><div>Thanks</div><div class="im"><div><br></div>-- <br>Asif Iqbal<br>PGP Key: 0xE62693C5 KeyServer: <a href="http://pgp.mit.edu" target="_blank">pgp.mit.edu</a><br>A: Because it messes up the order in which people normally read text.<br>


Q: Why is top-posting such a bad thing?<br><br>
</div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Asif Iqbal<br>PGP Key: 0xE62693C5 KeyServer: <a href="http://pgp.mit.edu">pgp.mit.edu</a><br>A: Because it messes up the order in which people normally read text.<br>

Q: Why is top-posting such a bad thing?<br><br>
</div>