What is the difference between Owner and User (WindowsIdentity)?
-
06-07-2019 - |
Question
When getting the username and/or SID of the current user, what is the preferred method?
Is it using:
WindowsIdentity.GetCurrent().Owner
Or:
WindowsIdentity.GetCurrent().User
What is the difference between the two? This would be a great question for SuperUser.com, but alas, it's not live yet. Thanks!
Solution
What you usually want is the User.
Every security object in windows has permissions and owner. The user is also a security object so it has permissions and owner. The ownership means that the owner can change the permission on the user. And the permission (in case of the user object ) means things like delete the user, change group membership and such. And all of this is not intersting in most cases. So what you need is the 'User'.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow