Skip navigation
SimonStahl
Currently Being Moderated

How to get the user domain with the Flex API

Nov 19, 2009 5:58 AM

Hi there

 

i made a custom application runing inside the LC workspace. There I get the LC SessionMap for the server communication as well as some user information:

 

// Get the session from the owning application
var session:SessionMap = SessionMap(Application.application.session);
var manager:ISessionManager = ISessionManager(session.getObject("lc.core.ISessionManager"));
username = manager.authenticatedUser.userid;
userdomain = manager.authenticatedUser.domain;

 

but unfortunately the userdomain is always null regardless that the user is definitely related to the default domain "DefaultDom". So how else can I load the domainname for the logged in user?

 

Thx Simon

 
Replies
  • Currently Being Moderated
    Jan 10, 2010 3:13 AM   in reply to SimonStahl

    Try to directly access the Adobe DB and find the Domain using the UserId (UIDSTRING column) in EDCPRINCIPALUSERENTITY table

     

    Here are some tips:

     

    1. Find the REFPRINCIPALID from EDCPRINCIPALUSERENTITY table for the given UIDSTRING

     

    2. Find the REFDOMAINID from EDCPRINCIPALENTITY table for the given ID as retrieved from step1

     

    3. Find the COMMONNAME from EDCPRINCIPALDOMAINENTITY table for the given ID as retrieved from step 2

     

    Nith

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 10, 2010 7:34 AM   in reply to $Nith$

    Simon,

     

    This looks like a bug. Would try to confirm that with the team.

     

    Now to get the Domain. You can try invoking the DirectoryManager.findPrincipal(oid). It would return a Principal object from there you can use domainName and domainCommonName to get the Domain details. The oid can be obtained from the user object returned by the sessionmanager

     

    Nith - Thanks for suggesting the approach. But a user can use LC API to get user details rather than directly accessing the DB. The brute force should be used as a last resort

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 11, 2010 2:01 AM   in reply to SimonStahl

    Hi Simon,

     

    You can also look into using the DirectoryManagerServiceClient from you Java component and use its findPrincipal API. This would allow you to invoke the LC UserManager API from Java code itself and would obviate the need for going via DB

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 11, 2010 9:25 AM   in reply to SimonStahl

    I know you've indicated that you are getting this info by some custom java coding but thought you might be interested in an alternative.  First, regardless of which approach you use, you should only make a server call to get the domainName if it is empty. We will be updating the code to populate the domainName field of User object in a (ES2) ServicePack so your code should prepare for this.

     

    The Workspace SessionManger class has a getRemotingEndpoint() method that can be used to hit any LiveCycle service that supports the REMOTING connector.  Since the DirectoryManagerService is only accessible by admins/system contexts and you likely don't want to open up all the APIs on this service to the masses, I suggest that you use Workbench to create a new process called getDomain with the following contents:

    - an input var called oid (a string),

    - an output called domainName (also a string),

    - uses the UserLookupService.findUser service (set to ExactMatch, map oid to the Universal ID filter field and map the output to a variable called user (type = User),

    - add a SetValue that sets the domainName output var from the user.domainName field

     

    From the Adminui, set the Security on the getDomain service to give AllPrincipals the INVOKE_PERM permission and set the RunAs to System (latter is to permit the UserLookupService call to work).

     

    The Workspace code to call this is:

    var theService:RemoteObject = sessionManager.getRemotingEndpoint("testapp/getDomain");
    var theOperation:AbstractOperation = theService.getOperation("invoke");
    var theToken:AsyncToken = theOperation.send({oid:sessionManager.authenticatedUser.oid});
    theToken.addResponder(new DefaultResponder(
         function /* result handler */(event:ResultEvent):void
         {
             trace("getDomain RemotingCall Success");
             trace("**** domainName="+event.result.domainName);
         },
         function /* fault handler */(event:FaultEvent):void
         {
             trace("getDomain RemotingCall Fault");
         }
    ));

    This was all done on ES2 but the concept is applicable to ES Update 1 as well ( I just didn't test it there).

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points