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====
_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

SAVE THOUSANDS OF DOLLARS ON RT SUPPORT:

If you sign up for a new RT support contract before December 31, we'll take
up to 20 percent off the price. This sale won't last long, so get in touch 
today. 
    Email us at [EMAIL PROTECTED] or call us at +1 617 812 0745.


Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com

Reply via email to