[rt-users] HasRight called with no valid object

Emmanuel Lacour elacour at easter-eggs.com
Fri Nov 30 04:14:27 EST 2007


Ehlo,

I have this curious message when running the follwing script on rt
3.6.3/RH4/Oracle9/DBIx::SearchBuilder 1.49 (with patch groupclause):

[crit]: HasRight called with no valid object
(/pkg/rt/rt/lib/RT/Principal_Overlay.pm:321)

It happen many times for SetPrivileged(0), but at the end, the function
succeed, the user is no longer Privileged.


Thanks for any hint/idea to explain/solve this :)

The script:

====cut====
my $users_obj = new RT::Users( $CurrentUser );
$users_obj->LimitToPrivileged;
while (my $user_obj = $users_obj->Next) {
        my $user_name = $user_obj->Name;
        if ($user_obj->HasRight( Object=> $RT::System, Right => 'SuperUser')) {
                print "User: $user_name skipped: SuperUser\n";
                next;
        }
        my $GroupMembers = RT::GroupMembers->new($CurrentUser);
        $GroupMembers->Limit( FIELD => 'MemberId', VALUE => $user_obj->Id );
        my $alias = $GroupMembers->Join(
        TYPE       => 'left',
        ALIAS1     => 'main',
        FIELD1     => 'GroupId',
        TABLE2     => 'Groups',
        FIELD2     => 'id'
        );
        $GroupMembers->Limit(
        ALIAS      => $alias,
        FIELD      => 'Domain',
        OPERATOR   => '=',
        VALUE      => 'UserDefined',
        );

        my $found = 0;
        while ( my $GroupMember = $GroupMembers->Next ) {
                $found = 1;
                last;
        }
        if ($found) {
                print "User: $user_name skipped: member of one or more groups\n";
                next;
        }

                if (!grep{ $user_name eq $_} @blacklist) {
                        print "User: $user_name\n" if ($debug);
                        print "\tAction: unset privileged\n" if ($debug);
                        ($code,$msg) = $user_obj->SetPrivileged(0) if (!$dryrun);
                        print STDERR "Unprivilege FAILED: User - $user_name: $msg\n" if ($msg !~ /That user is (now|already) unprivileged/);
                }
}
====cut====



More information about the rt-users mailing list