+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Control access to document library

Control access to document library

4 posts, 0 answered
  1. Ross Reichardt
    Ross Reichardt avatar
    31 posts
    Registered:
    14 Aug 2009
    24 Aug 2009
    Link to this post

    Hi.

    I am new to SiteFinity and am just learning my way. What we want to do is set up a document library but control access to it. Basically we want a way of knowing who is downloading documents from the library. The idea is that when a user tries to download a document, a form is popped up asking them for their name and email address before they can download the document. 

    What is the best way to do that in SiteFinity?

    Thanks and best regards,

    Ross.

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    24 Aug 2009
    Link to this post
    Hello Ross Reichardt,

    You  should map the external template LibraryItemList. Then create a code behind of this control template. In the code behind get reference to ClientTemplate and check the currently logged user using UserManager class. If the user belongs to a given role - pop up your dialog, otherwise proceed.

    Sample code:

    ClientTemplate ct = GridTemplates.FindControl("ClientTemplate9"as ClientTemplate; 
            if(UserManager.IsCurrentUserInRole("users")) 
            { 
                string radalertscript = "<script language='javascript'>function f() {radalert('Welcome!', 330, 210); }</script>"
                Page.ClientScript.RegisterStartupScript(this.GetType(), "alert""alert('Enter your UserName ..');"true); 
            } 


    Greetings,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Ross Reichardt
    Ross Reichardt avatar
    31 posts
    Registered:
    14 Aug 2009
    26 Aug 2009
    Link to this post

    Hi Ivan.

    Thanks for your quick reply. As I said, I am new to SiteFinity and I don't understand what you mean by "You should map the external template LibraryItemList". I have looked through the available controls and could not find a LibraryItemList. Could you please explain a little more what you mean and how I can go about doing that?

    Thank you for your help!

    Regards,

    Ross.

  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    26 Aug 2009
    Link to this post
    Hello Ross Reichardt,

    Please take a look at the following KB article - How to map a view to an external template, in Sitefinity 3.6 or later?

    Regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Register for webinar
4 posts, 0 answered