Wednesday, December 10, 2008

Get current user for a workspace enabled flex application

Here is a sample code snippet if you have to pull user information or user credentials from the signed-in workspace user when a flex application is loaded as a process/form in workspace.

import lc.core.ISessionManager;
import lc.domain.SessionMap;
import mx.utils.ObjectUtil;

var session : SessionMap = SessionMap( Application.application.session );
var sessionManager : ISessionManager = ISessionManager( session.getObject( "lc.core.ISessionManager" ) );

trace( ObjectUtil.toString( sessionManager.authenticatedUser ) );

You'll see that authenticated user is mapped to lc.domain.User. You'll need the latest fds.swk and fds_rb.swc for this. Below is an example of what you'll get back.

(lc.domain::User)#0
address = (null)
description = (null)
displayName = "Super Administrator"
domain = (null)
email = ""
emailAliases = (null)
firstName = (null)
groups = (null)
initials = (null)
isOutOfOffice = false
lastName = (null)
locale = (null)
oid = "8D1446F6-A3DD-F4C2-378B-1B46089140AA"
session = (null)
telephone = ""
timezone = (null)
userid = "administrator"


4 comments:

  1. Anonymous2:34 PM

    HI! Great tips... another question... from a flex based application, I need to call a DSC component that requires to create a ServiceClientFactory... how can I create the ServiceClientFactory using the connection props of the user who is working with the flex based application???

    Thanks,
    Alessio

    ReplyDelete
  2. What service are you trying to call?

    ReplyDelete
  3. Anonymous7:37 PM

    Hi, I'm trying to do something similar - trying to get the list of tasks in livecycle from a flex app. How would I do that?

    Thanks

    ReplyDelete
  4. Have a look at http://help.adobe.com/en_US/livecycle/9.0/programLC/help/index.htm?content=001087.html, and more importantly http://help.adobe.com/en_US/livecycle/9.0/programLC/help/index.htm?content=001087.html for a head start on pulling this information.

    ReplyDelete