CLASS TCustomer from TRecord Method Save() endclass
Method Save()Class TCustomer ::Updated:= date()
// Compare all the data in ::aBuffer (new) with ::oTable:aBuffer (old) // Collect an array of fieldnames or numbers containing the different data // Loop through the array and make a string of the fieldnames and old and new data // Write the array to a log file.
I use the WNetGetUser() function to extract the logged in User Id on the workstation and save it to a Public variable xLogin .. I use xLogin to find the UserID stored in my security table to assign permissions as you saw earlier .. If there is no match .. I force a manual login.
You could also assign the value of WNetGetUser() to an object like Enrico mentions :
TUser():name:= WNetGetUser()
Basically I am leveraging SSO ( single sign on ) with WNetGetUser() ... a valuable tool and selling point to many Corporations .. the user logs into their workstation via a Corporate network account and WNetGetUser() extracts that UserId value from the workstation .. bounce that against your application security table table to apply permissions in your program.
I note that my WNetGetUser() returns only my first name. What happens if I attach to another network that already has someone with the same first name?
WNetGetUser() returns the Profile User Id ( or login name ) of the current user.. My Guess is your Profile name on your computer is ( just ) James. IN a network environment .. when a person first logs into a machine with their Corporate Credentials .. a new Profile is made .. and that becomes their default Profile.
My Personal Computer's profile name is "Rick Lipkin" and that is what WNetGetUser() returns ..
In a network environment when I am logged into my Corporate computer my UserId is "Lipkinrm" .. and that is the current Logged in user WNetGetUser() returns.
So what does WNetGetUser() return when you log your personal computer into your corporate network? Does it stop returning "Rick Lipkin" and start returning "Lipkinrm"?
If so, then it means that if you login to an app on your personal computer you cannot rely on it to always return the same login name. I am sure if that is a problem, just trying to understand.
You are correct .. WNetGetUser() returns the current 'logged in' profile Userid .. so I have two entries in my software depending on which machine or profile I currently am logged into .. one for 'Rick Lipkin' and one for 'LipkinRm'