SharePoint 2010 | Hidding the ribbon VS a SPSecurityTrimmed story

I've been struggling with the SPSecurityTrimmedControl, when using it to wrap controls so they only get seen by anonymous/logged in users.

Turns out the control doesn't work right so neither using PermissionString or AuthenticationRestrictions will get the job done.

Possible values for PermissionString (http://msdn.microsoft.com/EN-US/library/ms412690):
EmptyMask
ViewListItems
AddListItems
EditListItems
DeleteListItems
ApproveItems
OpenItems
ViewVersions
DeleteVersions
CancelCheckout
ManagePersonalViews
ManageLists
ViewFormPages
Open
ViewPages
AddAndCustomizePages
ApplyThemeAndBorder
ApplyStyleSheets
ViewUsageData
CreateSSCSite
ManageSubwebs
CreateGroups
ManagePermissions
BrowseDirectories
BrowseUserInfo
AddDelPrivateWebParts
UpdatePersonalWebParts
ManageWeb
UseClientIntegration
UseRemoteAPIs
ManageAlerts
CreateAlerts
EditMyUserInfo
EnumeratePermissions
FullMask



Possible values for AuthenticationRestrictions:
AuthenticatedUsersOnly
AnonymousUsersOnly
AllUsers

Bug Post
http://social.msdn.microsoft.com/forums/en-US/sharepointdevelopment/thread/00ed3f14-8b73-47f2-a651-4c0b2d246a6e/


Possible Types
http://sharepointforum.com/en-US/Bugday/Lists/Posts/Post.aspx?ID=66


Lately I've come up with something that easily hides controls from the page.
Since you can't use SPSecurityTrimmedControl (unless you create a custom version of it) and since you can't simply add controls to the LoginView, at least you can add an inline style that will conditionally hide/show content.



   

   

Comments

  1. Thank you for a great article. Can you describe how this process can work on a .html page layout or .html master template for sharepoint 2013?

    ReplyDelete
  2. in html pages you cannot add asp.net controls. you would need to convert your master page to a .master master page to take advantage of the same workaround provided in this article. a more "tricky" way is to do the whole thing by javascript: find if the user is logged in or not and inject a style. this would work on an html page.
    http://msdn.microsoft.com/en-us/library/office/jj822370%28v=office.15%29.aspx

    ReplyDelete

Post a Comment

Popular posts from this blog

Breaking down document locking in SharePoint

Working around X-Frame-Options for iframes

Document ID not being generated