Connect to a SharePoint Server

Please note that I am talking about injecting my code into the server side of SharePoint (through a package / add-on, etc.), as opposed to using Microsoft.SharePoint.dll or web services to access SharePoint.

So my problem is that I need to configure the work of document libraries, including custom permission management. I was looking at Microsoft.SharePoint.dll analysis of the internal components of its work. Here are my observations:

  • SPDocumentLibrary provides the basic logic for managing a document library. However, its not a WebPart in itself.
  • The actual rendering of the web parts for the document library is probably handled by ListViewWebPart or a derived class.
  • Actually the SPPictureLibrary class, which leads me to suggest that it is possible to inherit the SPDocumentLibrary class to provide custom behavior in the document library.
  • WebPartAdder.SiteWebPartGalleryProvider somehow connects the SPDocumentLibrary to its WebPart inside the Microsoft.SharePoint.WebPartPages.WebPartAdder.AddSources method.

Now all this is the client side, none of this happens on the SharePoint server itself (afaik). However, I see SPSecurableObject methods on an SPSecurableObject that the SPDocumentLibrary / SPList overrides, in particular:

  • CheckPermissions
  • GetUserEffectivePermissionInfo
  • GetUserEffectivePermissions
  • EffectiveBasePermissions , etc.

What I really want to do is override CheckPermissions / EffectiveBasePermissions on the SPDocumentLibrary inside the SharePoint server to introduce my own logic.

I would divert my research to server-side DLLs and understand them. But I would like to get some expert opinion on whether this is possible at all / indicated in the right direction. A hallmark of Microsoft (especially considering ASP.NET 2.0 / ASP.NET MVC as a reference) is the extensibility / structure of the provider. They provide great providers for the β€œthings” out of the box, but you can create your classes by inheriting / implementing something to replace the default providers. So:

  • Can I add a SharePoint server to the server. My ideal solution would be to create a derived class SPDocumentLibrary (on the server side) and implement it so that when you instantiate the document library my class object is created (instead of SPDocumentLibrary , assuming the SPDocumentLibrary Also, I still need to β€œmirror” classes on the server side of SharePoint).
  • If 1) is nopes, can I create a custom WebPart to use the SharePoint document library so that it gives the original document library, but still allows me to use the derived class SPDocumentLibrary when it accesses the web part (please try again , all my discussions relate to the SharePoint server, that is, my code running inside the process of the SharePoint / w3wp address space).
  • Why do we have logic in SPSite.EffectiveBasePermissions in general. I mean, it should be a CSOM, and it should just be responsible for serializing / deserializing what is returned / sent to the server. However, I see complex logic in this overridden property revolving around permission output.
  • If both options 1) and 2) are non-operations (literally :)), do I have the option of managing effective SharePoint permissions when working in the SharePoint address space before SharePoint takes any action based on these permissions.

I know this was a long question, but I hope I do my research well.

+5
source share
1 answer

I do not think you have this level of control in SharePoint.

Not sure if you looked at the SharePoint Events option. Instead of creating your own class to add logic, you could add logic as a SharePoint event. You can subscribe to relevant events and add logic accordingly. For example, you can cancel the update based on your logic. However, I do not think that you can configure the basic resolution logic.

The SPList has a CheckPermissions method, which in turn calls the "CheckPermissions" of the base class (SPSecurableObject). However, I doubt that you can create your own subclass, overwrite the appropriate methods and take on the permission logic. This is something that is very important for SharePoint, which I believe is not meant to be configured.

+2
source

Source: https://habr.com/ru/post/1272786/


All Articles