There is SharePoint's site with custom welcome page (which is a HTML page) designed to have custom navigation menu. Navigation urls are like this:

http://google.com (any other resource outside of sharepoint)

I need to check if user has access to those different sites and if not to hide related nodes from navigation menu. What's the simplest solution here?


Following function will help you to find the permission level for user. here permission level checked is"viewListItems" , you can find rest of the permissionkind from here : https://msdn.microsoft.com/en-us/library/ee556747(v=office.14).aspx

function CheckPermission(){
  SP.SOD.executeFunc('SP.Runtime.js', 'SP.ClientContext',
    function() {
      SP.SOD.executeFunc('SP.js', 'SP.ClientContext',
      function() {
        var siteUrl = _spPageContextInfo.webAbsoluteUrl;
        var clientContext = new SP.ClientContext(siteUrl);
        var web = clientContext.get_web();
        clientContext.load(web, 'Title', 'EffectiveBasePermissions');
        clientContext.executeQueryAsync(onSuccess, onError);
function onSuccess(){
  alert('Title: ' + web.get_title());
  var permissions = SP.PermissionKind.manageWeb && SP.PermissionKind.viewListItems;
    alert('user has the required permissions');
function onError(sender, args) {
  alert(args.get_message() + '\n' + args.get_stackTrace());

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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