Hiding the Ribbon for Anonymous Users

23 באפריל 2010

תגיות: ,
8 תגובות

If you are designing a public facing internet site based on SharePoint 2010, you probably don’t want the ribbon in your design. Still, the ribbon provides the basic tools that your authors use, so you probably need a way to show it only to them.

Ribbon_FormatText

I have tried so search for opinions and implementations for this on the web, and found several different approaches to complete this task.

Client side:

Pros: It’s easy to integrate into your site. Toggling visibility of the ribbon is super fast.

Cons: The entire control hierarchy is still loaded to the page, so it makes loading a bit slower.

Here is a video that shows you how you can check for anonymity, and hide the ribbon using java script:
http://www.youtube.com/watch?v=k5vg4DYUJNI

Server Side:

Pros: You have more control over what happens and when. Say, if you wanted to hide the ribbon based on a custom logic. Also, the Ribbon doesn’t render at all – faster loading times.

Cons: Harder to implement. Switching the ribbon on and off (if possible) is slow. Harder to implement. Requires admin and server access.

Here is a post that shows how to hide the ribbon by using SPSecurityTrimmedControl, which is a standard SharePoint control that gives control over content that needs to be security trimmed:
http://www.thesug.org/Blogs/kyles/Lists/Posts/ViewPost.aspx?ID=34&RootFolder=/Blogs/kyles/Lists/Posts

Another approach is to use LoginView, which is a standard ASP.net control:
http://vspug.com/benrobb/2008/06/20/howto-display-parts-of-a-page-to-anonymous-users-only/

Another server side approach, which to I haven't found references, might be to place the ribbon inside a EditModePanel control. In this approach, the ribbon will be shown only when the page is in edit mode. This approach is relevant only to publishing pages.

Login Control:

Regardless of the approach you choose, you should remember that the “Login” control is actually placed inside the ribbon, and so if we hide the ribbon, users won’t be able to log in.

The solution is easy, take the login control (it’s name is “wssuc:Welcome”) and move it from the ribbon to somewhere else on the page.

הוסף תגובה
facebook linkedin twitter email

כתיבת תגובה

האימייל לא יוצג באתר. שדות החובה מסומנים *

8 תגובות

  1. Patrick Stalljohann5 במאי 2010 ב 12:16

    Hello Itay, thank's for your approaches.

    Another server side approach is hide only specific tabs, groups or controls for anonymous users with SPRibbon.TrimById.

    You can use server side logic and you could place different delegate controls on the page, which do the job. In this way you can still allow contextual tabs, for document libraries for example, to appear. So anynomous are able to use tab commands like "connect to outlook".

    הגב
  2. Itay Shakury5 במאי 2010 ב 22:21

    Hi Patrick, Thanks for your comment.
    The situation the I was aiming with this post is when you don't wan't to keep the ribbon just for stuff like connect to outlook.
    I agree that your suggestion could work for other situations where I can keep the ribbon, but don't want all of it.
    Thanks for the suggestion!

    Itay.

    הגב
  3. Alexey26 ביוני 2011 ב 12:56

    You can see another solution how to hide it and decide if it fits your needs here: http://alexsharepoint.blogspot.com/2011/06/hiding-ribbon-for-anonymous-users.html

    הגב
  4. icon clip art18 בספטמבר 2012 ב 0:40

    Bravo, what words…, an excellent idea

    P.S. Please review 48×48 Free Object Icons from Ikonga

    הגב
  5. icons18 בספטמבר 2012 ב 11:07

    In my opinion you are mistaken. Let's discuss it. Write to me in PM.

    P.S. Please review Cash register v2 Icon from phorago

    הגב