Article

mkreim's picture
article
Reads:

3261

Score:
2
2
1
 
Comments:

0

Retrieve logged in user in UserApp forms

Author Info

18 May 2011 - 10:35am
Submitted by: mkreim

(View Disclaimer)

Sometimes you need to know which user is using a form of a workflow, e.g. to control the form fields depending on user attributes or group memberships. This is not a problem for the request form because UserApp provides the initiator as a process property. But the User Application does not provide a function or property telling you the DN of the user using an approval form.

The solution is a custom service that gets the user DN from the application server.

Here are the steps needed to add this functionality to the UserApp:

  1. Stop the application server and backup the IDM war file.
  2. Copy the IDM war into a temp directory and open the war with an archiving tool.
  3. Rename the attached zip file to jar and copy it into the WEB-INF/lib directory of the war file.
  4. Extract and open the UIControlRegistry.xml located in WEB-INF directory.
  5. Add the following lines in the service section of the UIControlRegistry.xml
  6.  <service resultType="json" authenticated="true" config="true">
     <key>loggedInUser</key>
     <classname>de.computacenter.ims.nim.ua.ajaxservices.LoggedInUserService</classname>
     </service>
    
    
  7. Save the UIControlRegistry.xml and copy it back to the WEB-INF directory of the IDM war.
  8. Copy the IDM war to the deploy directory of the application server and start the User Application.

Now you can execute the service within a script of any workflow form.

	var loggedInUser;
	var serviceResult = IDVault.execService("loggedInUser", null);
	if(serviceResult != null) {
		loggedInUser = serviceResult._data.raw;
	}

The loggedInUser variable now contains the DN of the user.

Attachmentサイズ
loggedinuserservice.zip1.99 KB

Disclaimer: As with everything else at Cool Solutions, this content is definitely not supported by Novell (so don't even think of calling Support if you try something and it blows up).

It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test, test, test before you do anything drastic with it.




User Comments

© 2013 Novell