Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Basically when you select Insert -> Web Part you get this menu:

enter image description here

Is it possible to determine what is available here based on a users role?

share|improve this question

3 Answers 3

I just came across this post from Waldek that might be useful for you.

share|improve this answer
    
Very interesting link. In the code example he gives it does not go into much detail about where that would exist. Would I put this inside of a webpart or something? –  Abe Miessler Nov 15 '11 at 21:04
    
I'm not sure to be honest. I'll see if I can get Waldek to look at this. I came across that post from Google Plus as I was skimming the forums here and thought it would be useful. –  PirateEric Nov 15 '11 at 21:19
    
It's a delegate control and you can activate it on any scope you wish depending on your scenario. –  Waldek Mastykarz Nov 15 '11 at 21:49
    
Ok, I figured out what a delegate control is. @WaldekMastykarz, do you know if it's possible to Include items in the WebPartAdder based on the group a web part is in rather than the Recommendation Settings? –  Abe Miessler Nov 15 '11 at 23:11
    
Unfortunately with the default source you don't have that much choice: the Recommandation Setting is the only way to do it using the ootb source. –  Waldek Mastykarz Dec 5 '11 at 16:35

Go to the Web Part Gallery in your Site Collection. Select the Web Part. In the ribbon under the Documents Tab choose Document Permissions. There you can manage permissions for the web part.

share|improve this answer

I think it can be done. I've worked with the Web Part Adder class myself, thanks to Wictor and Anders. The class runs within the context of the user, so you can use that to possibly strip out specific web parts you don't want a user to see, depending on security role.

Keeping track of what specific web parts a user can and cannot see is up to you, as you have full control of the class which gets the web parts for the gallery.

share|improve this answer
    
So where would I put the code that works with the Web Part Adder? –  Abe Miessler Nov 15 '11 at 21:25
1  
Here's Wictor's article: wictorwilen.se/Post/… The block of code you want to focus on is the GetItemsCore() method, in there you'll implement the logic to trim which web parts to return. Note that this method populates web part into what is shown as a "Group". Might not be the result you're after though. –  James Love Nov 15 '11 at 21:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.