Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

List/Document Security (Removing New Document, Upload Document, etc

  Asked By: Denny    Date: Sep 24    Category: Sharepoint    Views: 1971

Can anyone point me into the right direction on how I could customize sharepoint
to remove the buttons "New Document", Upload Document, New Folder, etc on
document librarys for example if I am logged in as a reader. Someone is
requesting that they not even show up since you are logged in as a reader
anyways (which it won't allow you to do those actions anyways, it just brings up
another login box which would be confusing for some users, it is best to just
not show it at all), thus all those options shouldn't even be visible.

Share: 

 

4 Answers Found

 
Answer #1    Answered By: Matt Prince     Answered On: Sep 24

Onet.xml??????????????????????????

 
Answer #2    Answered By: Brooks Bond     Answered On: Sep 24

Actually, I see how you can do it for the most part. If you create a new
document library, then go to C:\Program Files\Common Files\Microsoft Shared\web
server extensions\60\TEMPLATE\1033\STS\LISTS\DOCLIB

and open schema.xml.

Say for example  I want to get rid of New document  and upload  Document. Do the
following:

Search for the following code block in CAML:


<Switch><Expr><GetVar Name="ModListAllItemsView"/></Expr>
<Case Value="1">
</Case>
<Default>
<HTML><![CDATA[
<td class="ms-toolbar"> <table cellpadding=1 cellspacing=0 border=0> <tr>
<td class="ms-toolbar" nowrap> <a tabindex=2 ID=diidNewItem class="ms-toolbar"
ACCESSKEY=N href="javascript:]]></HTML><GetVar
Name="WPQ"/><HTML><![CDATA[createNewDocument();"
title=]]></HTML><HTML>"New"</HTML><HTML><![CDATA[><img
src="/_layouts/images/newdoc.gif" ID="tbbutton1N"
alt=]]></HTML><HTML>"New"</HTML><HTML><![CDATA[ border=0 width=16
height=16></a></td> <td nowrap> <a tabindex=2 class="ms-toolbar" ACCESSKEY=N
ID=diidNewItem href="javascript:]]></HTML><GetVar
Name="WPQ"/><HTML><![CDATA[createNewDocument();">]]></HTML> <HTML>New
Document</HTML> <HTML><![CDATA[</a></td> </tr></table></td>
<TD class=ms-separator>|</TD>
<td class="ms-toolbar"> <table cellpadding=1 cellspacing=0 border=0> <tr>
<td class="ms-toolbar" nowrap> <a tabindex=2 ID=diidIOUploadItem
class="ms-toolbar" ACCESSKEY=U href="]]></HTML><URL
Cmd="New"/><HTML><![CDATA[?RootFolder=]]></HTML><GetVar Name="RootFolder"
URLEncode="TRUE"/><HTML><![CDATA[" onclick="javascript:]]></HTML><GetVar
Name="WPQ"/><HTML><![CDATA[NewDoclibItem(']]></HTML><ScriptQuote
NotAddingQuote="TRUE"><URL Cmd="New"/></ScriptQuote><HTML><![CDATA[',
false);javascript:return false;" target="_self"
title=]]></HTML><HTML>"Upload"</HTML><HTML><![CDATA[><img
src="/_layouts/images/upload.gif" ID="tbbutton1U"
alt=]]></HTML><HTML>"Upload"</HTML><HTML><![CDATA[ border=0 width=16
height=16></a></td> <td nowrap> <a tabindex=2 class="ms-toolbar" ACCESSKEY=U
ID=diidIOUploadItem href="]]></HTML><URL
Cmd="New"/><HTML><![CDATA[?RootFolder=]]></HTML><GetVar Name="RootFolder"
URLEncode="TRUE"/><HTML><![CDATA[" onclick="javascript:]]></HTML><GetVar
Name="WPQ"/><HTML><![CDATA[NewDoclibItem(']]></HTML><ScriptQuote
NotAddingQuote="TRUE"><URL Cmd="New"/></ScriptQuote><HTML><![CDATA[',
false);javascript:return false;" target="_self">]]></HTML> <HTML>Upload
Document</HTML> <HTML><![CDATA[</a></td> </tr></table></td>
]]></HTML>
</Default>
</Switch>

If you remove  that, then the New Document and Upload Document disappear. So
what I want to know now, is how can you get the current security  context within
caml (reader, contributor, etc). If I can do that then it would look something
like this I would imagine:

<Switch><Expr><GetVar Name="ModListAllItemsView"/></Expr>
<Case Value="1">
</Case>

<Switch><Expr><GetVar Name="SECURITYCONTEXT"/></Expr>
<Case Value="Reader"></Case>
<Default></Default><!-- SHOW NOTHING -->
<Case Value="Contributor"></Case>
<Default>
<HTML><![CDATA[
<td class="ms-toolbar"> <table cellpadding=1 cellspacing=0 border=0> <tr>
<td class="ms-toolbar" nowrap> <a tabindex=2 ID=diidNewItem class="ms-toolbar"
ACCESSKEY=N href="javascript:]]></HTML><GetVar
Name="WPQ"/><HTML><![CDATA[createNewDocument();"
title=]]></HTML><HTML>"New"</HTML><HTML><![CDATA[><img
src="/_layouts/images/newdoc.gif" ID="tbbutton1N"
alt=]]></HTML><HTML>"New"</HTML><HTML><![CDATA[ border=0 width=16
height=16></a></td> <td nowrap> <a tabindex=2 class="ms-toolbar" ACCESSKEY=N
ID=diidNewItem href="javascript:]]></HTML><GetVar
Name="WPQ"/><HTML><![CDATA[createNewDocument();">]]></HTML> <HTML>New
Document</HTML> <HTML><![CDATA[</a></td> </tr></table></td>
<TD class=ms-separator>|</TD>
<td class="ms-toolbar"> <table cellpadding=1 cellspacing=0 border=0> <tr>
<td class="ms-toolbar" nowrap> <a tabindex=2 ID=diidIOUploadItem
class="ms-toolbar" ACCESSKEY=U href="]]></HTML><URL
Cmd="New"/><HTML><![CDATA[?RootFolder=]]></HTML><GetVar Name="RootFolder"
URLEncode="TRUE"/><HTML><![CDATA[" onclick="javascript:]]></HTML><GetVar
Name="WPQ"/><HTML><![CDATA[NewDoclibItem(']]></HTML><ScriptQuote
NotAddingQuote="TRUE"><URL Cmd="New"/></ScriptQuote><HTML><![CDATA[',
false);javascript:return false;" target="_self"
title=]]></HTML><HTML>"Upload"</HTML><HTML><![CDATA[><img
src="/_layouts/images/upload.gif" ID="tbbutton1U"
alt=]]></HTML><HTML>"Upload"</HTML><HTML><![CDATA[ border=0 width=16
height=16></a></td> <td nowrap> <a tabindex=2 class="ms-toolbar" ACCESSKEY=U
ID=diidIOUploadItem href="]]></HTML><URL
Cmd="New"/><HTML><![CDATA[?RootFolder=]]></HTML><GetVar Name="RootFolder"
URLEncode="TRUE"/><HTML><![CDATA[" onclick="javascript:]]></HTML><GetVar
Name="WPQ"/><HTML><![CDATA[NewDoclibItem(']]></HTML><ScriptQuote
NotAddingQuote="TRUE"><URL Cmd="New"/></ScriptQuote><HTML><![CDATA[',
false);javascript:return false;" target="_self">]]></HTML> <HTML>Upload
Document</HTML> <HTML><![CDATA[</a></td> </tr></table></td>
]]></HTML>
</Default>
</Switch>
</Switch>

However, I have no idea how to get the security context you are currently in and
am just paraphrasing what the CAML *might* look like. Does anyone know how you
might do this???

 
Answer #3    Answered By: Gregg Wilkinson     Answered On: Sep 24

check membership of contributors group.
If "authenticated users" or some other dynamic group is a member these buttons
may show  up even if user is only a reader  according to manageable group
membership.

 
Answer #4    Answered By: Darrel Sexton     Answered On: Sep 24

SharePoint has a downfall in that it doesn’t do visual filtering on operations the user cannot do. Having said that, you can remove  the links if you want by cloning a document  library list in a site via the site definition files. In there you can tweak the toolbar and such, but without writing a custom web part that reproduced the functionality of the doclib, you cannot filter out what the user doesn’t have access to through just config or schema files. Check out the SDK for information on creating a new list from an existing one and editing the toolbar.

 

Related Topics:




 

Related Post