Skip to Content
author's profile photo Former Member
Former Member

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

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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Nov 11, 2014 at 03:17 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      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.

      login.png (334.7 kB)

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.