Question

I'm trying to have an image show up within a webpart based on the authorization group of a user.

Is there a way to assign a specific audience to an image within a WebPart rather then the entire WebPart?

Thanks!

Was it helpful?

Solution

You can use SPSecurityTrimmedControl in webpart design file,

<Sharepoint:SPSecurityTrimmedControl runat=”server” Permissions=”ViewPages”>
//Only users with ViewPages permissions will be able to see this content.
<img src="test.gif" alt="test" height="42" width="42">
</SharePoint:SPSecurityTrimmedControl>

SPSecurityTrimmedControl which performs the security trimming of the child controls inside it. Just include our control inside this control and it will be displayed or hidden based on the permission specified.

Here is detail example http://www.c-sharpcorner.com/UploadFile/40e97e/security-trimmed-control-in-sharepoint-2013/

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top