0

I have a list which contains multiple users that they will access it from 2 different groups permissions, Members (Read Only), Visitors(View Only).

What I have tried to do:

  • When they are assigned to a group they are able to see it knowing that View only permission is the same as the group one.
  • When I assign the users outside the group as View only permission they are not able to see it. But I want to hide it from group permission because I am using a code that will hide excel feature only for groups.
  • Also, I have tried to remove the groups from quick launch, but as result nothing happens and they still are able to see it.

What I want to achieve:

  • Hide the quick lunch in the left pane of the screen from those 2 groups. But the others group like owners are able to see the Quick lunch.

Is it possible to achieve it?

1 Answer 1

0

You can use the JavaScript code to hide the quick launch when the current user is in the Members group/ Visitors group, you can check the demo below:

<script src="https://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>

<script>

$(document).ready( function()

function isCurrentUserMemberOfGroup(groupName) {

var userIsInGroup = false;

$.ajax({

async: false,

headers: { "accept": "application/json; odata=verbose" },

method: "GET",

url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/currentuser/groups",

success: function (data) {

data.d.results.forEach( function (value) {

if (value.Title == groupName) {

userIsInGroup = true;

}

});

},

error: function (response) {

console.log(response.status);

},

});

return userIsInGroup;

}

function HideMasterStyles() {

var isMembers=false;

isMembers = isCurrentUserMemberOfGroup("Members");

if(isMembers)

{ 
$("#sideNavBox").css("display", "none");
}

}

SP.SOD.executeOrDelayUntilScriptLoaded(HideMasterStyles,'SP.js');

});

</script>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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