Email from RT landing in yahoo bulk folder

ROBERT David wrote:

Mike,

I changed my User_Local.pm the way you advised. For fields not needing any change, I get lines like this
[Fri Feb 22 11:03:44 2008] [debug]: SetAddress1 Failed. Ceci est d�j� la valeur actuelle (/opt/rt3/lib/RT/User_Local.pm:614) (french for “This is already current value”)

But when it comes to fields needing an update that’s another story:
[Fri Feb 22 11:03:44 2008] [debug]: SetExternalAuthId Failed. Acc�s refus� (/opt/rt3/lib/RT/User_Local.pm:614) (french for “Acces Denied”).

Mike Peachey wrote:

The problem is almost certainly permissions, and I’ve suddenly come a
cropper on it too.

Then it definitely is the permissions issue.

Note the following I said before:

Since you are calling the Set$method methods on the User Object itself,
if that user doesn’t have permission to change their own details, you
can’t do it.

You can get around it by doing something like this which is to create an
RT::SystemUser object, and then load the user inside it.

         my $UserObj = RT::User->new($RT::SystemUser);
         $UserObj->Load($name_to_update);
         my ($val, $message) = $UserObj->Set$method($value);

Kind Regards,

Mike Peachey, IT
Tel: +44 114 281 2655
Fax: +44 114 281 2951
Jennic Ltd, Furnival Street, Sheffield, S1 4QT, UK
Comp Reg No: 3191371 - Registered In England

ROBERT David wrote:

Ahem…
Sorry if I seem to be rather thickheaded but…
Where do you want me to put those lines of code? In my User_Local.pm?

You can get around it by doing something like this which is to create an
RT::SystemUser object, and then load the user inside it.

         my $UserObj = RT::User->new($RT::SystemUser);
         $UserObj->Load($name_to_update);
         my ($val, $message) = $UserObj->Set$method($value);

Wherever you are actually calling the Set$method or Update on the user
objects, whether that’s inside the modified User_Local.pm, or in your
own external code.

Replace:

$user->update();

with:

$power_user = RT::User->new($RT::SystemUser);
$power_user->Load($user->Name);
my ($success, $reason) = $power_user->Update/Set$method;
Kind Regards,

Mike Peachey, IT
Tel: +44 114 281 2655
Fax: +44 114 281 2951
Jennic Ltd, Furnival Street, Sheffield, S1 4QT, UK
Comp Reg No: 3191371 - Registered In England

Ok I fumbled around a bit and came with a code in User_Local.pm that looks like this:

        foreach my $key (sort(keys(%args))) {
            next unless $args{$key};
            my $method = "Set$key";

$self->$method($args{$key});

            my $power_user = RT::User->new($RT::SystemUser);
            $power_user->Load($self->Name);
            my ($method_success,$method_msg) = $power_user->$method($args{$key});
            if (!$method_success) {
                    $RT::Logger->debug("$method Failed. $method_msg");
            }

        }

Now if I update any of the fields mapped in RT from LDAP as defined in RT_SiteConfig.pm, it gets updated in RT. But - because there’s a ‘but’ - if I set one of those fields to blank in AD, it does not get blanked in RT.

At first I thought it was limited to some fields (I tried 1st with FreeformContactInfo) but it’s consistent with all fields: You can modify a field in AD and it gets updated in RT. But if the modification you want is to simply blank a field it won’t work. That is, you can change a field from “ABC” to “AB” or “XYZ” but you cannot change a field from “ABC” to “”. :frowning:

I seems that RT considers that if a field in filled in its database but that the AD field is empty there’s nothing to do at all.

Where should I look?

David ROBERT * Responsable Département IT
Direction Support et Hébergement GENERIX Group
Tel : +33 (0)3 20 41 48 35 * Mob : +33 (0)6 19 73 00 13
Ext : 1835 * drobert@generix.fr

ROBERT David wrote:

Ok I fumbled around a bit and came with a code in User_Local.pm that looks like this:

        foreach my $key (sort(keys(%args))) {
            next unless $args{$key};
            my $method = "Set$key";

$self->$method($args{$key});

            my $power_user = RT::User->new($RT::SystemUser);
            $power_user->Load($self->Name);
            my ($method_success,$method_msg) = $power_user->$method($args{$key});
            if (!$method_success) {
                    $RT::Logger->debug("$method Failed. $method_msg");
            }

        }

What is the log output for

$RT::Logger->debug(“$method Failed. $method_msg”);

?

Specifically, what is the $method_msg?
Kind Regards,

Mike Peachey, IT
Tel: +44 114 281 2655
Fax: +44 114 281 2951
Jennic Ltd, Furnival Street, Sheffield, S1 4QT, UK
Comp Reg No: 3191371 - Registered In England