Multiple Library Providers

Posted by Community Admin on 03-Aug-2018 17:11

Multiple Library Providers

All Replies

Posted by Community Admin on 18-Mar-2011 00:00
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" />


I've tried to do something similar in SF4 under Admin / Settings / Libraries / Providers, but I'm not sure how to have the new library provider display in the user interface.  I see that under Settings / Libraries / Providers / Controls there are relevant controls and views, but there are so many to recreate, is there anyway to inherit or duplicate the ones that already exist?

Can anyone describe the steps I would need to go through to complete this?  Any help is greatly appreciated, thanks!
Posted by Community Admin on 24-Mar-2011 00:00
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
Posted by Community Admin on 24-Mar-2011 00:00
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
Posted by Community Admin on 24-Mar-2011 00:00
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");

And for user roles
RoleManager.GetManager("Default")

if you want a predefined role
RoleManager.GetManager("AppRoles")
Posted by Community Admin on 24-Mar-2011 00:00
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)?
Posted by Community Admin on 24-Mar-2011 00:00
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
Posted by Community Admin on 29-Mar-2011 00:00
Is it possible to add a provider for users / roles as well?
Posted by Community Admin on 29-Mar-2011 00:00
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
Posted by Community Admin on 30-Mar-2011 00:00
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?
Posted by Community Admin on 01-Apr-2011 00:00
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

Posted by Community Admin on 15-Apr-2011 00:00
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?
Posted by Community Admin on 15-Apr-2011 00:00
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
Posted by Community Admin on 18-Apr-2011 00:00
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

Posted by Community Admin on 18-Apr-2011 00:00
Just tried that, doesn't seem to work.
Posted by Community Admin on 20-Apr-2011 00:00
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

Posted by Community Admin on 17-May-2011 00:00
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.
Posted by Community Admin on 18-May-2011 00:00
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,
Milena
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Posted by Community Admin on 18-May-2011 00:00
I still have the issue of the same content appearing in the different providers as the video shows above.
Posted by Community Admin on 25-May-2011 00:00

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
This thread is closed