Search code examples
tridiontridion-2011

How can I retrieve the current user from a DataExtender?


I've written a DataExtender that 'hides' certain items from view. The idea is that some items should not be visible in any list in the GUI, even though the user may have access to it (similar to system files/folders in windows, which are not normally visible even though you are entitled to read them).

It's working fine, but now I want to make an exception for system administrators: they should always see every item. But I can't see how I can retrieve the current user from within my DataExtender. Is this even possible? If so, how?


Solution

  • You could use Tridion.Web.UI.Core.Utils.GetUserName() to get the Windows username and then create your own Core Service client, call Impersonate, and then call GetCurrentUser.