1

I have a menu item in my subsite menu (it is a term driven menu, so managed navigation) that links to a page with unique permissions. Only certain users have been given permissions to see the page and to edit it.

Let's say that person X and person Y have been given permissions to access this page and person Z doesn't have any permissions for this page at all. Page B is the page with the unique permissions.

This is the subsite menu that person X and Y see:

Page A
Page B
Page C
Page D

And this is the subsite menu that person Z should see:

Page A
Page C
Page D

However currently person Z can still see page B in the subsite menu, but upon clicking that menu item linked to page B, person Z will get a "You have no access to this page". I want person Z to not see that menu item at all, person Z shouldn't see page B in the menu.

I want the menu item to be hidden if the user has no permissions for the page behind that menu item.

How exactly can I achieve this?
I've been searching all day and I just can't figure it out, to me it seems that this should be default behavior that a page isn't listed in the navigation when the user has no permissions to access it (be it reading, editing, contributing,.. doesn't matter).

Any help is greatly appreciated!!!

EDIT
The answer to this question can be found here. It is quite long, please check the link for all the detailed information.

0

Something like this might suffice your requirements. I had to remove the settings buttons based on user privilege. So, I went ahead doing this.

if (belongsToGroup == true) 
{
    $('#suiteBarButtons').hide();
}

By using .hide() property you can disable the option in a way.

  • 1
    How exactly did you check if a user belonged to a group? The var belongsToGroup, how did you define it? I was thinking about getting all members of a group and put them in an array, and then check if the current user was in that array. If he/she was in the array, it would do nothing. If he/she wasn't, the link should be hidden. But I haven't even gotten to the part on fetching all the members of a certain group... So I was wondering how you did it. – Magali Oct 22 '13 at 14:21
  • @Magali You can create multiple SharePoint groups. Define client context and web, using which you can retrieve the groups var user = web.get_currentUser(); this.usergrps = user.get_groups(); clientContext.Load(this.usergrps); – Amit Oct 23 '13 at 4:39
  • Ok so, I have 'website' instead of 'web', and now I added clientContext.load(website,'EffectiveBasePermissions');. In the function onRequestSucceeded, I added this to check the permissions: if (website.get_effectiveBasePermissions().has(SP.PermissionKind.editListItems)) { //User Has Edit Permissions alert('YEAH, edit list permissions!'); } else { alert('Boo, no edit list permissions!'); } Thanks! Now I get it and it works, I just have to replace the alerts with the ID or class of the menu item and hide it. :) – Magali Oct 23 '13 at 7:35

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.