Frage

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 :)

War es hilfreich?

Lösung

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit sharepoint.stackexchange
scroll top