user3697028
user3697028

Reputation: 23

How to give permission to menus in Sharepoint after branding

I have performed branding in one of my sharepoint 2013 site. Below are the steps I foloowed 1. Created a HTML file. 2. Converted it to master page using Design Manager.

So what i need is, I have two menus in that html file say "Code Sample","Documents".

After converting it to masterpage, I want to give permission to this menu. ie. When person A login to the site, only "Code Sample" should available. When person B login to the site, only "Documents" should available.

Upvotes: 0

Views: 448

Answers (1)

Cecilia
Cecilia

Reputation: 321

You can show/hide components of the page based on masks (SPBasePermissions)

In the Snippet Gallery of the Design Manager, you can find the Security Trim (SPSecurityTrimmedControl):

To display content only to those users who have a specified level of security permissions, you can use a Security Trim Control. Specify one or more permission levels in the Behavior section of this control's properties. You can set it to many common permission levels, including the option to show content to no one but contributing site authors or site administrators. Then, insert the component on your page and place any content - including other SharePoint components - inside of it.

Here and example:

<div data-name="SecurityTrimmedAdministrators">
    <!--CS: Start Security Trim Snippet-->
    <!--SPM:<%@Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>-->
    <!--MS:<SharePoint:SPSecurityTrimmedControl runat="server" Permissions="FullMask ">-->
        <!--PS: Start of READ-ONLY PREVIEW (do not modify)--><span><!--PE: End of READ-ONLY PREVIEW-->
        <div class="DefaultContentBlock" style="border:medium black solid; background:yellow; color:black; margin:20px; padding:10px;">
        You should replace this div with content that renders based on your Security Trim Properties.

        </div>
        <!--PS: Start of READ-ONLY PREVIEW (do not modify)--></span><!--PE: End of READ-ONLY PREVIEW-->
    <!--ME:</SharePoint:SPSecurityTrimmedControl>-->
    <!--CE: End Security Trim Snippet-->
</div>

So, you can change the Permissions property of the SharePoint:SPSecurityTrimmedControl with other masks like EmptyMask, ViewListItems...

Upvotes: 0

Related Questions