Spectrum Spatial (SSA/LIM)

Welcome to the Spectrum Spatial (SSA/LIM) community - start a discussion in the discussion tab or join in a conversation.

SSA Documentation  LIM Documentation  SSA Ideas  LIM Ideas

Discussions

Members

Resources

Events

 View Only
  • 1.  How to capture the user names logged in SSA and use the value in some other button action developed in SSA dynamically?

    Posted 09-11-2017 04:33

    I've been trying to find the username variable for SSA login page. I wanted to capture the login id and store the value and then i will use login value in some other button action which I have created on SSA. But the struggle was to find the variable which login Id stored. Can someone please help me with this.

    The only alternative option that I have is creating different map configuration with all different users if I am not able to crack this username capture.

    Looking forward to the forum help! Thanks in advance



  • 2.  RE: How to capture the user names logged in SSA and use the value in some other button action developed in SSA dynamically?

    Posted 09-13-2017 02:55
      |   view attached

    Hi Miss @Amita Mehta? 

    Around 4 to 5 prospect clients were expecting this kind of solution when ever they log in to the SSA they would want to see different interfaces depends on their role and perform variant operations based on the requirements. Most of them will be addressed with Management console and Analyst admin. But there are very few requirements where we are trying to customize SSA in server level.

    Since our SSA is developed with Angular, it is very tough to find out the ID or Value for logged in user. I have tried finding the right location of the angular file using Fiddler as most of the developers do. I have hit the Analyst connect URL on the server to see the files which consist of the logged in user value.

    I have found this through Fiddler as interesting where i found the logged in user value

    /*{"authenticationInfo": {"user": {"username": "admin"}, "authType": {"isPublicUser": "false"}, "properties": [{"name": "sso.start.url", "value": "\/connect\/analyst\/login.jsp?InnerTargetResource=http%3A%2F%2Flocalhost%3A8010%2Fconnect%2Fanalyst%2Fcontroller%2Fauthentication%2Fgetinfo%3FnoCache%3D1505283544799"}, {"name": "slo.start.url", "value": "j_spring_security_logout"}], "access": "public"}}*/

     

    i was not able to find the file in server path to find out any angular page which consists "value " : J_spring_security_logout

     

    When i inspect with Google chrome, I got this

     

    Capture

    If you see in the highlited line, It has an ID called usernameLb1 and Value called Title.

    Whenever i change the user while logging, Title gets changed. I have searched with Fiddler and other Network monitoring tools to findout usernameLb1 or Title. Still no luck.

    I am an underdogg in coding and stuff, But i can say I'm amzed with the Architeture of SSA. Its Awesome

    I am looking forward to your suggestions on this. Hope we can solve this soon!

     



  • 3.  RE: How to capture the user names logged in SSA and use the value in some other button action developed in SSA dynamically?

    Posted 09-18-2017 02:08

    Hi Krishna,

     

    I assume you are using SSA 12 in SSA 12 you have a service

     

    getInfo, that gives you information about current logged in  user. It looks something like below.

     

    http://stratusdevpr2.pbi.global.pvt:8010/connect/analyst/controller/authentication/getinfo?noCache=1505714276564

    Response

    /*{"authenticationInfo": {"user": {"username": "Guest"}, "authType": {"isPublicUser": "true"}, "properties": [{"name": "sso.start.url", "value": "\/connect\/analyst\/login.jsp?InnerTargetResource=http%3A%2F%2Fstratusdevpr2.pbi.global.pvt%3A8010%2Fconnect%2Fanalyst%2Fcontroller%2Fauthentication%2Fgetinfo%3FnoCache%3D1505714276564"}, {"name": "slo.start.url", "value": "j_spring_security_logout"}], "access": "public"}}*/

    If you see we have logged in username right now Guest but once you login it will give logged in username.

    You can call this service via ControllerApiSrvc,  if it is going to be called from customTemplate that you need to get hold of $angular object to get hold of the ControllerApiSrvc.

     

    Thanks

    Awkash

    ?



  • 4.  RE: How to capture the user names logged in SSA and use the value in some other button action developed in SSA dynamically?

    Posted 09-18-2017 08:31

    @Amita Mehta?  Hi Amita, I will be very much happy if you can consider my prior understanding on the issue and let me know the further steps to crack this issue as soon as possible :)



  • 5.  RE: How to capture the user names logged in SSA and use the value in some other button action developed in SSA dynamically?

    Posted 09-18-2017 09:27

    Hi Krishna,

     

    You don't have to grab ui elements of SSA, rather use just our service to get current logged in user. Something like below will do the trick. I am assuming that you are going to put this code in one of the custom template in SSA 12.

    function getAuthInfo() {

     var $body = angular.element(document.body);

      

      var controllerAPISrvc = $body.injector().get("controllerAPISrvc");

      

      var url = controllerAPISrvc.authenticationAPI.getUrl();

      var options = {

       url: url,

       method: "get",

       params: {noCache: new Date().getTime()}

      };

        apiInvokerSrvc.invokeControllerAPI(options).then(function (authInfo) {

         console.log('Current logged in AuthInfo', authInfo);//

      });

      

      }

     

     

    ?



  • 6.  RE: How to capture the user names logged in SSA and use the value in some other button action developed in SSA dynamically?

    Posted 09-18-2017 09:31

    Adding modified code as you may need instance of apiInvokerSrvc as well in the function.

     

    function getAuthInfo() {

     var $body = angular.element(document.body);

      

      var controllerAPISrvc = $body.injector().get("controllerAPISrvc");

      var apiInvokerSrvc = $body.injector().get("apiInvokerSrvc");

      

      var url = controllerAPISrvc.authenticationAPI.getUrl();

      var options = {

       url: url,

       method: "get",

       params: {noCache: new Date().getTime()}

      };

        apiInvokerSrvc.invokeControllerAPI(options).then(function (data) {

         console.log(data);

      });

      

      }?



  • 7.  RE: How to capture the user names logged in SSA and use the value in some other button action developed in SSA dynamically?

    Posted 09-19-2017 01:23

    Thanks @Awkash Agrawal? and @Amita Mehta?  I am working as per your advice. I hope I will make it work. Will get back to you if I face any challenge. Thanks for the response.



  • 8.  RE: How to capture the user names logged in SSA and use the value in some other button action developed in SSA dynamically?

    Posted 09-19-2017 16:49

    Krishna,

    Is there a reason you cannot use the role based access built into Spectrum and Analyst? Users are grouped into roles and different roles are assigned access to whatever maps they need.  Is that what you are trying to do??



  • 9.  RE: How to capture the user names logged in SSA and use the value in some other button action developed in SSA dynamically?

    Posted 09-20-2017 02:08

    Hi @Eric Blasenheim? I wanted to create a custom query on the single table which should work whenever the user clicks a custom created button on SSA and showcase the results based on the logged in user. That's the idea I am looking for. To do this I need to capture the username but not sure about it. It would very much grateful if you can let us know much easier process :) Cheers.