User defined upload and gallery

Last post 07-20-2010, 1:34 PM by ASPMan. 5 replies.
Sort Posts: Previous Next
  •  07-20-2010, 8:39 AM 62623

    User defined upload and gallery

    Hi,
     
    I am new to the cuteeditor and we just bought this control for our development team. What I was wondering is if there is a way to specify who can upload files/images to where ever and then only view their uploaded files/images? I have th control set up to upload images to uploads folder now with the gallery folder being the same, but what I want to do is when a user clicks on the gallery or insert image, automatically filter the viewable selection based on some codebehind from our rolebased system. Any help would be great,
  •  07-20-2010, 9:17 AM 62627 in reply to 62623

    Re: User defined upload and gallery

    Please refer to http://cutesoft.net/example/implementSecuritypolicy.aspx , you can find its source code in installation package.
     
    Regards,
    Eric
  •  07-20-2010, 9:19 AM 62628 in reply to 62623

    Re: User defined upload and gallery

    ASPMan,
     
    Yes, you can specify the different security policy file for different users. You can also set different security option for different users/roles.
     
    The security policy file (default.config, admin.config and guest.config) can be found in the /CuteEditor/Configuration/Security folder. In security policy file you can find the different security options. By default, it contains the following value:
    <security name ="AllowUpload" >true</security>
    <security name ="AllowModify" >true</security> 
    <security name ="AllowRename" >true</security> 
    <security name ="AllowDelete">true</security> 
    <security name ="AllowCopy">true</security>
    <security name ="AllowMove">true</security> 
    <security name ="AllowCreateFolder">true</security> 
    <security name ="AllowDeleteFolder">true</security>
     
    Editor1.Setting["security:AllowUpload"]= "false";
    Editor1.Setting["security:AllowModify"]= "false";
    Here is an example:
     
     
    The source code of this example can be found in the download package.
     
    Hope it helps.
     
    Keep me posted

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  07-20-2010, 10:25 AM 62632 in reply to 62628

    Re: User defined upload and gallery

    So far this is has been a great start between the suggestions you guys made here to adding in functionality to handle file prefix feature, I have set it up to seperate the images/files by directory and then added the prefix to further define who can view what within the directory.
     
    One more question I have though is how do I change the users role from code behind? As in if I want to change user X to have Admin access from code, I havent been able to find examples of this functionality.
  •  07-20-2010, 12:51 PM 62636 in reply to 62632

    Re: User defined upload and gallery

    You need to implement your own methods based on your project to detect the current user security role, GetSecurityRoleFromYourAPP will return user role:

       string userrole= GetSecurityRoleFromYourAPP();
       switch(userrole)
       {
        case "Administrators":
         Editor1.SecurityPolicyFile  = "Admin.config";
         SetUploadsFolder("~/Uploads/");
         break;
        case "Members":
         Editor1.SecurityPolicyFile  = "default.config";
         SetUploadsFolder("~/Uploads/Member/");
         break;
        case "Guest":
         Editor1.SecurityPolicyFile  = "Guest.config";
         SetUploadsFolder("~/Uploads/Guest/");
         break;
      //  case "Banned":
      //   Editor1.ReadOnly = true;
      //   break;

         case "John":
         Editor1.SecurityPolicyFile  = "Admin.config";
         SetUploadsFolder("~/Uploads/Users/John/");
         break;
        case "Mary":
         Editor1.SecurityPolicyFile  = "default.config";
         SetUploadsFolder("~/Uploads/Users/Mary/");
         break;
        case "Tim":
         Editor1.SecurityPolicyFile  = "default.config";
         SetUploadsFolder("~/Uploads/Users/Tim/");
         break;
       }
     
     
    Regards,
    Eric
  •  07-20-2010, 1:34 PM 62637 in reply to 62636

    Re: User defined upload and gallery

    Thanks this is exactly what I was looking for, just wasnt positive on the syntex used to switch the security policy. Got it now.
     
    Thanks
View as RSS news feed in XML