Please note I am talking of injecting my code into SharePoint server-side (via a package / add-in etc) as opposed to using Microsoft.SharePoint.dll or web-services to access SharePoint.
So my problem is this, I need to customise how Document Libraries work, including custom permission management. I have been browsing through Microsoft.SharePoint.dll analysing the internals of its working. Here are my observations:
SPDocumentLibraryprovides the core logic of managing a document library. However, its not aWebPartin itself.- The actual web part rendering for a Document Library probably is handled by
ListViewWebPartor a derived class. - There's actually a
SPPictureLibraryclass which makes me assume it might be possible to inheritSPDocumentLibraryclass to provide custom behaviour on a Document library. WebPartAdder.SiteWebPartGalleryProviderin some way is connectingSPDocumentLibraryto itsWebPartinsideMicrosoft.SharePoint.WebPartPages.WebPartAdder.AddSourcesmethod.
Now all this is client-side, none of this happens on SharePoint server itself (afaik). However I see overridable methods on SPSecurableObject that SPDocumentLibrary/SPList override, specifically:
CheckPermissionsGetUserEffectivePermissionInfoGetUserEffectivePermissionsEffectiveBasePermissions, etc.
What I really want to do is be able to override CheckPermissions / EffectiveBasePermissions on a SPDocumentLibrary inside SharePoint server to inject my custom logic.
I would now divert my research to SharePoint server side dlls and understanding them. But I would love to get some expert opinion on whether this is feasible at all / pointed in the right direction. Microsoft's hallmark (especially considering ASP.NET 2.0 / ASP.NET MVC as a benchmark) is extensibility / provider framework. They provide excellent providers for "things" out of the box but you can create your classes by inheriting/implementing something to replace default providers. So:
- Can I inject into SharePoint server-side. My ideal solution would be to create a
SPDocumentLibraryderived class (server-side), and inject it in so that anytime a Document library is instantiated, my class object is created (instead ofSPDocumentLibrary, assuming that's the class server-side too. I still need to "reflect" SharePoint server-side classes). - If 1) is a nopes, can I create a custom
WebPartto use a SharePoint Document Library in a way where it gives a native Document Library feel, but still allow me to use aSPDocumentLibraryderived class when that web part is accessed (please again note, all my discussion is around SharePoint server-side, i.e. my code executing inside SharePoint's address space/w3wp process). - Why do we have logic in
SPSite.EffectiveBasePermissionsat all. I mean its supposed to be CSOM, and it should simply be responsible for serialization/deserialization of what is returned by/sent to server. However, I see elaborate logic in this overridden property revolving around permission deducing. - If both 1) and 2) is a no-op (literally :)), do I have any option manipulating SharePoint effective permissions while operating in SharePoint's address space before SharePoint takes any action based on those permissions.
I know its been a long question, but hopefully I am doing my research well.