cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

We are happy to announce the new Windchill Customization board! Learn more.

API for Windchill User Login Event

BenPerry
13-Aquamarine

API for Windchill User Login Event

When a user logs in, there is a record added to the database in the AUDITRECORD table.  I assume some java code is executed when a user logs in, to put that record in the database.

I was thinking about leveraging this API to do some additional things, such as check the user's preferred file server (their vaulting preference).  I could add additional code to this java class do what I desire.  But first I need to determine what API is triggered during the login.

Anyway have ideas of which API(s) are triggered during user login?

5 REPLIES 5
akhan
1-Newbie
(To:BenPerry)

Whenever a user logs in I think SessionUserAuditEvent.LOGIN event is fired. See if you can do what you want in this event listener.

BenPerry
13-Aquamarine
(To:akhan)

Abdul,

Thanks.  I added a System.out.println() statement to SessionUserAuditEvent(), but I didn't see anything in the MS or BMS logs.  Should I expect to see something there?  Or somewhere else?

  public SessionUserAuditEvent(String paramString, WTPrincipalReference paramWTPrincipalReference, long paramLong, int paramInt)

  {

    super(paramString);

    this.event = paramString;

    this.user = paramWTPrincipalReference;

    this.time = paramLong;

    this.concurrency = paramInt;

    System.out.println("\n\n\n\n\nMyStatement\n\n\n\n\n");

  }

BenPerry
13-Aquamarine
(To:akhan)

Abdul,

Nevermind.  I'm an idiot.

  1. I might not have saved the .java file before compiling.
  2. I certainly did not restart Windchill.  Restarting is necessary so it will pick up a new .class file instead of using the cached one.

After the Windchill restart, I refreshed a page, and "My Statement" was printed to the foreground MS log.  This is a start.  I might have more questions later.

BenPerry
13-Aquamarine
(To:akhan)

Abdul,

A few observations after running it for a little while today...

  1. It does indeed "re-login" a few times through the day.  The Windchill server kept running, and the code was triggered 3 times.  But the user never restarted the browser.  He was in the same session.  (10:40 AM, 11:16 AM, 1:17 PM)
  2. Somehow, it is being triggered even without the user logging into Windchill.  For example, I restarted the server, but never refreshed my browser page or anything.  I was busy doing other things.  But during that time, my name was printed to the MS log.

FYI...Here are my current modifications to wt.session.SessionUserAuditEvent:

  public SessionUserAuditEvent(String paramString, WTPrincipalReference paramWTPrincipalReference, long paramLong, int paramInt)

  {

    super(paramString);

    this.event = paramString;

    this.user = paramWTPrincipalReference;

    this.time = paramLong;

    this.concurrency = paramInt;

    // START ADDITION

    System.out.println("\n\n\n");

    System.out.println("Login event for " + user.getIdentity());

    System.out.println("\n\n\n");

    // END ADDITION

  }

BhushanNehe
14-Alexandrite
(To:BenPerry)

Hi Ben,

Was the user inactive. Looks like there was no activity and the session was timeout after a certain interval defined by wt.session.sessionUsers.timeout property, you can add log-out event to check if that was the case.

Regards,

Bhushan

Top Tags