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"


2 comments:

Anonymous said...

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

Michael Imhoff said...

What service are you trying to call?