Book a Demo

Author Topic: Getting Current User for Javascript Add-in  (Read 2803 times)

BrianYee

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Getting Current User for Javascript Add-in
« on: August 04, 2020, 04:59:20 am »
Hello,

I am currently trying to create an add-in which blocks users from creating connectors to and from diagram objects which are locked or for which they do not belong to the proper security group. I do this by using Repository.SQLQuery and querying the t_secuser, t_seclocks, and t_secusergroup tables. I am trying to get the current user's username in order to search the UserLogin column of t_secuser. Session.UserName returns the user's AD username which is different than the UserLogin, so the addin is not functional in its current state. How should I go about getting the current user's UserLogin or UserID?

I am using Sparx 15.1 and am making use of a JavascriptAddin class with the EA_OnPreNewConnector signal.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Getting Current User for Javascript Add-in
« Reply #1 on: August 04, 2020, 07:37:19 am »
string GetCurrentLoginUser (bool GetGUID) — see the Repository class help for details.

q.

BrianYee

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: Getting Current User for Javascript Add-in
« Reply #2 on: August 15, 2020, 05:01:04 am »
Thank you, qwerty. This works.