cancel
Showing results for 
Search instead for 
Did you mean: 

How can I take username from session and show it at the headerItem on HANA SHELL

Former Member
0 Kudos

Hi all,

I have solved this problem before with the below code:

Code:

var username = '';

jQuery.ajax({

          url: "/sap/hana/xs/ide/editor/server/dbinfo.xsjs",

          type: 'GET',

          dataType: "json",

          async:false,

          success: function(data, s, xhr) {

          if (xhr.getResponseHeader("x-sap-login-page")) {

                  return;

              }

              if (data) {

              username = data.user;

              }

          },

      });

But after that I created a new user which haven't got editor privilage so that this code become useless.

Can anybody help me about taking username from session and showing it  on shell?


NOTE: I'm using sap.ui.ux3.Shell.

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member182302
Active Contributor
0 Kudos

Hi Kemal,


SELECT SESSION_USER "session user" FROM DUMMY;

The above statement would give the session_user from HANA side. May be you can consume the output?

Regards,

Krishna Tangudu

Former Member
0 Kudos

Hi Krishna,

Sorry for late response.

I tried the code that you gave me but it is returning 'SYSTEM' user.

I mean the username which i wrote in below screen.

Is it because I'm logging in as an anonymous user and that user is 'SYSTEM' user? How can i solve this problem?

.xsaccess

{

  "exposed" : true,

  "authentication" :{

  "method": "Form"

  }

}

Thanks.