SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have tried following solution to check the current user's permissions on the current host web in a SharePoint hosted app, however the user is always administrator.

function sharePointReady() {
     hostweburl = decodeURIComponent(getQueryStringParameter('SPHostUrl'));
     appweburl = decodeURIComponent(getQueryStringParameter('SPAppWebUrl'));

     context = new SP.ClientContext.get_current();
      hostWebContext = new SP.AppContextSite(context, hostweburl);

     currentWeb = hostWebContext.get_web();
     user = hostWebContext.get_web().get_currentUser();
     context.load(currentWeb, 'EffectiveBasePermissions');

      context.executeQueryAsync(onAppReadySuccess, onAppReadyFailed);

function onAppReadySuccess() {

share|improve this question
Can you provide some additional details? What permissions does the user actually have? Even if the user does not have permissions he is shown having the full mask permissions? – Vardhaman Deshpande Mar 7 '13 at 5:23
Now when I have tested and logged in to my dev machine as Another user the code returned right person. the problem is when you use /_layouts/closeConnection.aspx?loginasanotheruser=true to log in as Another user then the user is Always that user that has loged on into the machine – Medes Mar 7 '13 at 13:56
That's probably because you have to close the current browser session and open a new one before you login as another user. – Vardhaman Deshpande Mar 7 '13 at 14:18


function onAppReadySuccess() {
   var isSiteAdmin = currentUser.get_isSiteAdmin();
   if (isSiteAdmin == true)
     console.alert('I am an administrator');
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.