Content Management and Capture

 View Only
  • 1.  How to retrieve user info of logged in user in custom Content Navigator Plugin

    Posted Mon September 18, 2023 10:30 AM

    Hi,

    Not sure if I am posting in the correct groupa - its the only group I got access to.


    I am working on a Content Navigator Plugin where I need to get hold of the user id for the logged in user in Content Navigator.
    Does anyone have any clue how I can achieve this?



    ------------------------------
    Andreas Baaserud Hauge
    ------------------------------


  • 2.  RE: How to retrieve user info of logged in user in custom Content Navigator Plugin

    Posted Tue September 19, 2023 02:21 AM

    Hi,

    Did you tried to get the user id from ecm.model.desktop.userId in browser side or callbacks.getUserId in java side?



    ------------------------------
    JIE ZHANG
    ------------------------------



  • 3.  RE: How to retrieve user info of logged in user in custom Content Navigator Plugin

    Posted Tue September 19, 2023 03:08 AM
    Edited by Andreas Baaserud Hauge Tue September 19, 2023 07:35 AM

    callbacks.getUserId - will try it out :)

    Do you have an example how I can use ecm.model.desktop.userId to retrieve the userid?

    Thanks @JIE ZHANG



    ------------------------------
    Andreas Baaserud Hauge
    ------------------------------



  • 4.  RE: How to retrieve user info of logged in user in custom Content Navigator Plugin

    Posted Tue September 19, 2023 07:40 AM

    Hi @JIE ZHANG,

    I might be missing something

    calling PluginServiceCallbacks.getUserid() return null

    You got an idea what I'm doing wrong here?



    ------------------------------
    Andreas Baaserud Hauge
    ------------------------------



  • 5.  RE: How to retrieve user info of logged in user in custom Content Navigator Plugin

    Posted Tue September 19, 2023 09:10 AM
    Edited by Andreas Baaserud Hauge Tue September 19, 2023 09:10 AM

    Here's what I did to get hold of the user id

    # Preliminary - Passing PluginServiceCallbacks callbacks Plugin
    
    # get hold of the ODServer object by the repositoryID
    ODServer server = callbacks.getODServer(repositoryId);
    
    # Now we can retrieve user info
    String userId = server.getUserId();



    ------------------------------
    Andreas Baaserud Hauge
    ------------------------------



  • 6.  RE: How to retrieve user info of logged in user in custom Content Navigator Plugin

    Posted Wed September 20, 2023 01:30 AM

    Great! I will try it when I got an ODServer to play with.



    ------------------------------
    JIE ZHANG
    ------------------------------



  • 7.  RE: How to retrieve user info of logged in user in custom Content Navigator Plugin

    Posted Wed September 20, 2023 02:23 AM

    Please check documentation: PluginServiceCallbacks (ibm.com)

    You need the context of a repository to determine the user via the callbacks instance. So make sure that you also pass repository information with PluginServices (in PluginRequest/ResponseFilters you already should have this information).

    On the client side in the dojo part you can simply access the user id (but only the id!) via ecm.model.desktop.userId - since ICN version 2.0.2: JsDoc Reference - ecm.model.Desktop (ibm.com)

    best regards
    Christoph



    ------------------------------
    Christoph Sünderkamp
    ------------------------------