locked
Hiding certain list views from View Selector, Sharepoint 2010 RRS feed

  • Question

  • Hello

    I'm running custom javascript to hide views based on the user that is logged in. My question is if there is an easy way to hide views I don't want that user to see in the drop down View Selector. I've seen solutions for this in 2007, but they don't seem to work in 2010.

    Here's an example, Admins can see all views (V1, V2, V3), but if a client is logged in they can only see the first two (V1, V2) so V3 is hidden from the drop down. I already have the logic to track and find permissions, I just can't figure out how to hide the specific view in the drop down.

    Thanks in advance.


    • Edited by KP21361 Monday, June 10, 2013 5:57 PM
    Monday, June 10, 2013 5:55 PM

Answers

  • I do not believe applying permissions  to views (even if possible) would be a good practice. Views, by design, weren't provided as a security feature for lists. There are two aspects I read from your discussion post - 1) hiding content and/or 2) restricting access to content. For 1) you will have to make use of the Audience feature. For 2) you have to go by assigning permissions to list items. If you just want to hide without applying permissions, you might want to consider doing the following instead:

    1. Create a blank page.

    2. Add a list view web part to display a specific view of your list.

    3. Apply the web part to be visible to a specific 'Audience'.

    You can add as many list view web parts referencing each view targeted to each specific audience. This, however, would not restrict users from gaining access to list items because 'Audience' is not a security feature. 

    Tuesday, June 11, 2013 12:39 PM

All replies

  • Hi,

    Thank you for your post.

    I'm trying to involve someone familiar with this topic to further look at this issue.

    Best Regards.


    Kelly Chen
    TechNet Community Support

    Tuesday, June 11, 2013 7:55 AM
  • I do not believe applying permissions  to views (even if possible) would be a good practice. Views, by design, weren't provided as a security feature for lists. There are two aspects I read from your discussion post - 1) hiding content and/or 2) restricting access to content. For 1) you will have to make use of the Audience feature. For 2) you have to go by assigning permissions to list items. If you just want to hide without applying permissions, you might want to consider doing the following instead:

    1. Create a blank page.

    2. Add a list view web part to display a specific view of your list.

    3. Apply the web part to be visible to a specific 'Audience'.

    You can add as many list view web parts referencing each view targeted to each specific audience. This, however, would not restrict users from gaining access to list items because 'Audience' is not a security feature. 

    Tuesday, June 11, 2013 12:39 PM
  • Hi vjwilliam, thanks for the response.

    We understand that it would not be a 100% effective security method, the intent is to remove views that certain users don't need to see to decrease clutter and lessen the chance they see extraneous information. Previously I have been able to remove ribbon items such as "Edit in Datasheet" and "Open with Excel" using javascript and jquery to simply hide the elements on the page. I just wanted to see if anyone had been able to do the same with the items in the view selector menu.

    Previously I used something like document.getElementsByTagName('ie:menuitem'); to return all of the menu items, and then just setAttribute("hidden",true) for the ones that had matching text to what I wanted to hide but the views in view selector don't appear as menu items.

    Thanks


    • Edited by KP21361 Tuesday, June 11, 2013 1:37 PM
    Tuesday, June 11, 2013 1:34 PM
  • Just a suggestion; why not use the Audience feature? It is easier to implement without having to write client-side code or any code for that matter.
    Wednesday, June 12, 2013 11:40 AM