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

i need to add some security to a Document Library, i want to be able to have multiple folders and multiple documents. This feature would provide users with proper right to modify, read, hide documents and folders depending on what the owner of the document agreed on.

Exemple: UserA creates a documentA, UserA shares documentA to UserB with write and read permission. UserA gives UserC read only permission for documentA. UserD cannot see DocumentA because UserA did not give any permissions.

The user would go through a custom interface, create a folder, upload a document through custom controls and then have a UI to give rights to other site users to read and/or write the document.

For this i created a Document Library with custom types, MyFolders and MyDocument. I want my users to be able to change security/permissions settings of document they upload. So when i present the Document library to a user i can show the right files he has access to and so on.

I would like to write this with JQuery if possible or i can always code it on the backend with C#.

How can i use sharepoint to help me do this ? Where can i read more on this.

Thank you for any help :)

share|improve this question
    
I think you need to refine your requirements a little better. It is not clear to me exactly what you are looking for. Are you trying to create a replacement for the existing permissions administration pages in SharePoint? –  Robert Kaucher Apr 10 '12 at 14:44
    
I want for my users to be able to upload a document inside a folder and then make another user able to write and read the document and then make another user able to only read the document and also say a third user not able to see any document from the user that uploaded it. –  Dr.Denis McCracleJizz Apr 10 '12 at 14:48
    
This is possible through the administration pages for permissions. –  Robert Kaucher Apr 10 '12 at 14:59
    
The documents aren't static so i cannot do this through Sharepoint administration. –  Dr.Denis McCracleJizz Apr 10 '12 at 15:05
    
How is it determined which users get which permissions? Is this going to be automatically assigned based on some sort of algorithm or is there a human process involved where people make the decisions about who should see what before the document is published to the users who should have access. Please add these explanations and what you mean by "documents aren't static" to your question. Even if documents are being added at different times for different reasons you can apply permissions to individual documents via the standard interface. So it's hard for me to see why that is inadequate. –  Robert Kaucher Apr 10 '12 at 15:15
show 1 more comment

1 Answer

up vote 1 down vote accepted

I'm sorry that it seems I am being oppositional to your question, but from what you have explained to me everything can be done via the SharePoint permissions interface. You can use it to break the inheritance of permissions on a specific document and assign permissions to other users as well.

If you want to rewrite the permissions interface and do this using JQuery you can use the JavaScript Client Object Model to find the item in question and then set permissions on it.

Once you get the item you can have them select a user...

var user = (Principal)clientContext.Web.EnsureUser(userNameString);
var contributor = clientContext.Web.RoleDefinitions.GetByType(RoleType.Contributor);
var roleDefinitionBindingCollection = new RoleDefinitionBindingCollection(clientContext) { contributor };
//update the roles for the item.
listItem.RoleAssignments.Add(user, roleDefinitionBindingCollection);
listItem.Update();

Here are two articles that will give you an idea of how you might go about that.

http://geeks.netindonesia.net/blogs/ekasinggih/archive/2011/11/21/set-listitem-permission-using-client-object-model-on-sharepoint-2010.aspx

http://blogs.kirankawalli.com/2011/08/item-level-permissions-using-sharepoint.html (this is the managed Client Object Model but you can adapt the ideas.)

Here is the MSDN reference for the JavaScript CSOM, which you will need to visit a lot as there isn't too much out on the web to accomplish what you want.

share|improve this answer
    
thanks alot, this is what i wanted, and by using the Sharepoint permission interface i thought you meant the Sharepoint Aministration site's interface. Anyhow, Thanks again :) –  Dr.Denis McCracleJizz Apr 10 '12 at 15:45
    
I was hoping to really get more details out f you because I think this is actually a cool idea, especially if combined with things like work flow. I can see this as something that I need to keep in mind as, knowing my organization, I'll be asked to build something like this in the future. Anyways, it's my pleasure! –  Robert Kaucher Apr 10 '12 at 17:07
add comment

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.