You are viewing limited content. For full access, please sign in.

Question

Question

Custom Web Access Button: Get the User's Name

asked on June 9, 2016 Show version history

Hello! I'm trying to create a custom Web Access button to get the active username of the user that clicked the button. Using the code samples in EDM 302: Advanced Web Customizations, I think I'm close.

I know how to get the user's connection using:

WebAccessSession WASession = WebAccessSession.GetSessionObject();

But now what? I don't see anything in the `WebAccessSession` object that returns the user's name. Any ideas?

(To be clear, I just need the user's name as string, I don't need the user object.) 

0 0

Replies

replied on June 9, 2016

Ah, nevermind. I figured it out:

private static IDictionary<string, object>
           JumpToInbox(IDictionary<string, object> args)
        {
            Dictionary<string, object> retVal = new Dictionary<string, object>();

            //Retrieve and clone the user's repository connection.
            WebAccessSession WASession = WebAccessSession.GetSessionObject();
            LFDatabase db = WASession.ConnectionManager.GetLoggedInRepository();

            ILFSecurableTrustee trustee = WASession.CurrentTrustee(db);
            retVal["username"] = trustee.Name;

            return retVal;
        }

 

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.