ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Event Request] Page 9800 Users - function SetUserName

Open ViktorasDanielius opened this issue 2 years ago • 3 comments

Please add event OnBeforeSetUserName to Page 9800 Users function SetUserName:

    local procedure SetUserName()
    var
        IsHandled: Boolean;
    begin
        //>> New event
        OnBeforeSetUserName(Rec, XRec, WindowsUserName, IsHandled);
        if not IsHandled then
        //<< End
            "User Name" := WindowsUserName;

        ValidateUserName();
    end;
    [IntegrationEvent(false, false)]
    local procedure OnBeforeSetUserName(var User: Record User; var xUser: Record User; WindowsUserName: Text[208]; var IsHandled: Boolean)
    begin
    end;

Additional context

I see that similar requests already rejected due to security concern: https://github.com/microsoft/ALAppExtensions/issues/24665 https://github.com/microsoft/ALAppExtensions/issues/25958

But I think there is no problem with security - "User Name" can be changed after user is created. It is allowed and works ok. Problem is with new user creation - our customer wants to remove domain name. When they do that just after user creation, rename is triggered, it checks a lot of tables and causes huge number of locks. So we want to have an option to change the "User Name" just before it's creation. Internal work item: AB#550251

ViktorasDanielius avatar Sep 24 '24 11:09 ViktorasDanielius

This is just not the right way to go. Security concerns aside, SetUserName is a local procedure in the list page called on validation for Windows User Name. Let's assume we added this event, how about the same logic in the User Card? Then another event, then another...

Also not to mention Windows User Name field is only visible on premise, which you most certainly don't need an event for...

If you would like to change the username then you should do it on the table level, by subscribing to OnInsert/OnModify triggers.

onbuyuka avatar Nov 29 '24 12:11 onbuyuka

Why cannot you use OnBeforeInsert trigger and a subscriber to change the name?

nikolakukrika avatar Nov 29 '24 12:11 nikolakukrika

It's OK, we will try to solve the issue in different way. You can close this request.

ViktorasDanielius avatar Dec 03 '24 07:12 ViktorasDanielius