Jump to content
  • How to fetch the information about the logged in user in Spotfire® using IronPython Script.


    This article describes about how to fetch the user name, domain, group/role membership and other relevant information about the Logged in user in TIBCO Spotfire.

    Introduction

    This article describes about how to fetch the user name, domain, group/role membership and other relevant information about the Logged in user in TIBCO Spotfire.

    Changes in Spotfire 10.4

    TIBCO Spotfire® 10.4 has a new capability for fetching the user information. 

    There is a new Public API UserContext introduced in Spotifre version 10.4 to access user information

    UserContext Class

    Code Sample

    # Copyright © 2019. TIBCO Software Inc. Licensed under TIBCO BSD-style license.
    
    #for Spotfire versions 10.4 and above.
    
    from Spotfire.Dxp.Framework.ApplicationModel import *
    
    groups=''
    
    userContext=Application.GetService[UserContext]()
    
    #Fetch the Groups to which the Logged in User belongs to.
    for i in userContext.Groups:
    	groups=(groups+" "+i) 
    Document.Properties["Groups"]=groups
    
    
    #Fetch the username of the Logged in User
    u_name = userContext.Username
    Document.Properties["u_name"]=u_name
    
    
    #Fetch the Displayname of the Logged in User
    d_name = userContext.DisplayName
    Document.Properties["d_name"]=d_name
    
    #Gets the domain the user belongs to. This can be an actual LDAP domain or an internal Spotfire domain.
    domain_name = userContext.Domain
    Document.Properties["domain_name"]=domain_name
     

     

    References

    License:  TIBCO BSD-Style License

    Back to IronPyton Scripting in Spotfire Examples


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...