Jump to content
  • How to fetch the logged in Spotfire and Windows Usernames in Spotfire® using IronPython Script.


    Introduction

    Sometimes it's useful to get the Spotfire or Windows username in your script. Especially when faultfinding things on the Web Player. It can be convenient to know who/what account is executing your IronPython Script on your Web Player. If you use delegated credentials (Kerberos) it could be the same as the account you are logged into on your desktop. Alternatively, it could be the systems service account.

    Code Sample

    # Copyright © 2019. TIBCO Software Inc. Licensed under TIBCO BSD-style license.
    
    # Get the current user's username(s)
    
    from System import Environment, Threading, Security
    
    # This script assumes you have a document property called "myProperty" and will populate the property with the output.
    
    Document.Properties["myProperty"]  ="\nSpotfire Username: " + Threading.Thread.CurrentPrincipal.Identity.Name
    Document.Properties["myProperty"] +="\nWindows Username(Env): " + Environment.UserName
    Document.Properties["myProperty"] +="\nWindows Username(WinIdent): " + Security.Principal.WindowsIdentity.GetCurrent().Name
     

    License:  TIBCO BSD-Style License

     

     


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...