Multiple Library Providers
Hello,
I am looking for a way to have multiple Library providers, so that certain users can only have permissions/access to their group's relevant docs/images. I realize you can restrict the built in libraries to certain users, but that method wouldn't allow for users to create new libraries themselves (in the hopes of keeping attachments organized).
I had this setup in SF3.7 and I'm looking to achieve something similar in SF4. Here is the code I used in the web.config file back in 3.7 to achieve multiple libraries. In this example this would create a dropdown titled GroupA in the SF backend under Images/Docs module, which can then be assigned permissions per user group:
<
add
name
=
"GroupA"
urlRewriteFormat
=
"~/Provider/LibraryName/[Name]Extension"
urlDateTimeFormat
=
"yy-MM-dd"
urlWhitespaceChar
=
"_"
visible
=
"False"
defaultMetaField
=
"Name"
applicationName
=
"/GroupA"
allowVersioning
=
"False"
allowLocalization
=
"False"
localizationProviderName
=
""
allowWorkflow
=
"False"
securityProviderName
=
""
versioningProviderName
=
""
connectionStringName
=
"GenericContentConnection"
type
=
"Telerik.Libraries.Data.DefaultProvider, Telerik.Libraries.Data"
tagEditorTemplate
=
"~/Sitefinity/Admin/ControlTemplates/Libraries/BatchTagsEditor.ascx"
/>
<
add
key
=
"GroupA.Name"
valueType
=
"ShortText"
visible
=
"True"
searchable
=
"True"
sortable
=
"True"
defaultValue
=
""
/>
<
add
key
=
"GroupA.Width"
valueType
=
"Integer"
visible
=
"True"
searchable
=
"True"
sortable
=
"True"
defaultValue
=
""
/>
<
add
key
=
"GroupA.Height"
valueType
=
"Integer"
visible
=
"True"
searchable
=
"True"
sortable
=
"True"
defaultValue
=
""
/>
<
add
key
=
"GroupA.Size"
valueType
=
"Integer"
visible
=
"True"
searchable
=
"True"
sortable
=
"True"
defaultValue
=
""
/>
<
add
key
=
"GroupA.Extension"
valueType
=
"ShortText"
visible
=
"True"
searchable
=
"True"
sortable
=
"True"
defaultValue
=
""
/>
<
add
key
=
"GroupA.AlternateText"
valueType
=
"ShortText"
visible
=
"True"
searchable
=
"True"
sortable
=
"True"
defaultValue
=
""
/><
br
>
<
add
key
=
"GroupA.Author"
valueType
=
"ShortText"
visible
=
"True"
searchable
=
"True"
sortable
=
"True"
defaultValue
=
""
/>
<
add
key
=
"GroupA.Description"
valueType
=
"ShortText"
visible
=
"True"
searchable
=
"True"
sortable
=
"True"
defaultValue
=
""
/>
<
add
key
=
"GroupA.Category"
valueType
=
"ShortText"
visible
=
"True"
searchable
=
"True"
sortable
=
"True"
defaultValue
=
""
/>
<
add
key
=
"GroupA.PermaLink"
valueType
=
"ShortText"
visible
=
"True"
searchable
=
"True"
sortable
=
"True"
defaultValue
=
""
/>
<
add
providerName
=
"GroupA"
publicationDateField
=
"Publication_Date"
/>
Hello Brad,
You can easily add another provider to libraries, and then select which is going to be the default one. Please see the attached video, showing how you can do that.
Greetings,
Boyan Barnev
the Telerik team
Thank you Boyan!
The method you outlined in the video will suit my needs perfectly if I can find a way to assign a default provider for each different Role. Also, I will need to restrict access to the different providers (the ability to choose between the various providers in the backend gray bar) to any non-admins.
The goal would be for a user in Role-A to upload documents using Provider-A by default, and a user in Role-B to upload documents using Provider-B. I looked around the various settings in the Admin panel, but did not see where something like this could be achieved.
Can this be done?
Thanks!
Brad
Yea sounds possible, i think you would just need to specify your provider when uploading. For example when uploading an image
LibrariesManager albumManager = LibrariesManager.GetManager(
"MyProvider"
);
RoleManager.GetManager(
"Default"
)
RoleManager.GetManager(
"AppRoles"
)
Thanks Kristian!
Do you know which file controls the Upload logic, or where I would add such code?
Also, would I have a series of conditional statements, one for each role/provider (if user belongs to Role-A, then use Provider-A)?
You might want to take a look at the Sitefinity SDK on how to create a custom control to get started.
Yes you would need to check the role of the currently logged in user, then based on the role upload the image to the desired provider. There is some good documentation here
http://www.sitefinity.com/40/help/developers-guide/sitefinity-essentials-modules-media-modules-images-managing-images-creating-images.html
Is it possible to add a provider for users / roles as well?
Hi Kristian,
Yes, you can do this from the configurations - Administration >> Settings >> Advances >> Security.
Support for ASP.NET Membership and Role provider comes with Q1 through wrappers.
Regards,
Ivan Dimitrov
the Telerik team
I tried adding another provider under Membership Providers with type of Telerik.Sitefinity.Security.Data.OpenAccessMembershipProvider. I expected to see another tab showing my new provider under the user management page but don't see it there?
Hello Kristian,
Try restarting the application and then check the providers. Make sure that your custom is enabled. Inside the view where you create it there is a check box "isEnabled"
Regards,
Ivan Dimitrov
the Telerik team
I've been messing around with this and managed to botch the default provider, however my custom ones still show up.
Is there a way to reset the default provider? I tried deleting it and re-adding it, but it never shows up in the settings.
These providers contain content like images, documents, videos etc. What happens when you delete a provider in the backend?
Ok, ran into something else to. I thought we are allowed to get multiple data providers, not just 2? After I created the third it just displays the same data as the second one? I thought these were to be unique, is this a bug? will 4.1 cover this?
http://screencast.com/t/Uwrd1sp58
Hello Kristian,
Could you try to set parameter "applicationName" with different value for each of your providers. Then restart the application and try to upload an item.
Regards,
Ivan Dimitrov
the Telerik team
Just tried that, doesn't seem to work.
Hi Kristian,
Currently we still have issue with custom data providers for libraries. The issue will be resolved in the next hotfix.
Greetings,
the Telerik team
Has something changed on how these work? I'm having some trouble. The default provider has a field to add a ProviderDecoratorType but the custom ones don't. So when trying to upload an image to a secondary provider i get
No data provider decorator could be found for the provider 'DynamicModule.ns.Wrapped_OpenAccessLibrariesProvider_64501c48bf4747faae1f890f4f250a'. The method 'StorageProviderDecorator' has to be overridden and implemented.
Hello Kristian,
This bug is fixed at latest sitefinity 4.1 sp 1, you need to upgrade and then add a provider settings of type StorageProviderSettings(see attached screenshot)
All the best,I still have the issue of the same content appearing in the different providers as the video shows above.
Hello Kristian,
At the video below there is no parameter "applicationName" with different value for each of your provider. I tested with suppling different value of "applicationName" parameter and everything went fine.
Could you try to set parameter "applicationName" with different value for each of your providers. Then restart the application and try to upload an item(see attached file).
Let us know if you still experience any problems with configuring libraries providers.
All the best,
Milena
the Telerik team