This is a migrated thread and some comments may be shown as answers.

How to disable DELETE from the CONTEXT MENU while using FTP Management

3 Answers 137 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
Ajay
Top achievements
Rank 2
Ajay asked on 10 Dec 2009, 07:15 AM
Hi Telerik guys !

I have two ROOTS within my RADFILE EXPLORER.

For example :-
        + ----- FTP 

        + ----- ROOT


Iam getting the DELETE option for FTP(I can delete the folder/file within the FTP)

What Iam here is loking for is NOT TO SHOW the DELETE option for ROOT. 

Below is the code Iam have written for this :--

 protected void Page_Load(object sender, EventArgs e)  
    {  
        try 
        {  
            MessageLabel.Text = "";  
            SuccessImage.Visible = false;  
 
 
 
            if (Session["UserID"] == null)  
            {  
                Session.Clear();  
                Response.Redirect("~/ExpiredMessage.aspx");  
            }  
 
            RadScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "PopForReport""function newWindow(url) { var popupWindow = window.open(url,'popUpWindow','height=700,width=600,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no, location=no,directories=no, status=yes'); return false; }"true);  
            RadScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "ErrorHandler""function handlerFunction(description,page,line) {return true;} window.onerror = handlerFunction;"true);  
            RadScriptManager.RegisterClientScriptInclude(Page, Page.GetType(),"pasword_encrypt""script/encode.js");  
             
 
        }  
        catch (Exception ex)  
        {  
            //throw new Exception(ex.Message.ToString());  
            StackTrace stackError = new StackTrace(new StackFrame(true));  
            BLLError.SetErrorProperties(ex.Message, stackError, short.Parse(Session["UserID"].ToString()));  
        }  
 
 
        GetMappedPath GMP = new GetMappedPath();  
 
        Dictionary<stringstring> mappedPathsInConfigFile = GMP.GetMappingsFromConfigFile();  
        //string DocumentPath = "";  
        string[] DocumentPath = new string[2];  
        int index = 0;  
        foreach (KeyValuePair<stringstring> mappedPath in mappedPathsInConfigFile)  
        {  
            DocumentPath[index] = mappedPath.Value.Replace("/""\\");  
            index += 1;  
        }  
 
        string[] viewPaths = new string[] { DocumentPath[1], DocumentPath[0]};  
        //string[] uploadPaths = new string[] { DocumentPath[1], DocumentPath[0]};  
        string[] deletePaths = new string[] { DocumentPath[1] };  
 
 
 
        FTPManagementRadFileExplorer.Configuration.ContentProviderTypeName = typeof(FTPCustomFileSystemProvider).AssemblyQualifiedName;  
        FTPManagementRadFileExplorer.Configuration.ViewPaths = viewPaths;  
        FTPManagementRadFileExplorer.Configuration.DeletePaths = deletePaths;  
          
    }  
 

As from the above code :-

viewPaths ----> is for Both the FTP  &  Root

While,  deletePaths -----> is for FTP  only.


But when I run my application Iam not able to see the DELETE option removed from my ROOT option.

I dont know why is this so ??


Below is the SCREEN SHOT for this .


Please help ?

Ajay

3 Answers, 1 is accepted

Sort by
0
Fiko
Telerik team
answered on 15 Dec 2009, 12:28 PM
Hello Ajay,

 In order to help I need to examine the values stored in the DocumentPath[1] and DocumentPath[0] variables. Could you please paste the values here and I will do my best to help. Also, please paste the function that checks the delete permissions. For example, in the implemented FtpContentProvider in this KB we used the HasDeletePermissions that returns whether a path has delete permission or not.

I am looking forward to hearing from you.

Kind regards,
Fiko
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Ajay
Top achievements
Rank 2
answered on 16 Dec 2009, 06:53 AM

Hi Fiko !

I have attached the four screen shots , out of which two SCREEN SHOT lets you what values Iam getting within my DocumentPath[0] & DocumentPath[1].

While, two other SCREEN-SHOTS lets you to show what values Iam getting within my

viewPath  & what in deletePath

Please acknowledge the attachments.

Apart from that I have pasted the function that checks the delete permission within the FTPCustomFileSystemProvider.cs class.

 public override bool CheckDeletePermissions(string virtualTargetPath)  
    {  
        string physicalTargetPath = this.GetPhysicalFromVirtualPath(virtualTargetPath);  
        if (physicalTargetPath == null)  
            return false;  
 
        // The upload permission is no set ==> no write permission;  
        // Also check whether the write permission is set in the fileSystem   
        return HasDeletePermission(physicalTargetPath) && FileSystem.CheckWritePermission(physicalTargetPath, virtualTargetPath);  
    } 

also,

 private bool HasDeletePermission(string physicalPath)  
    {  
 
        foreach (string deletePath in this.DeletePaths)  
        {  
            if (GMP.AddSlashAtEndOfPhysicalPath(physicalPath).StartsWith(GMP.AddSlashAtEndOfPhysicalPath(deletePath), StringComparison.CurrentCultureIgnoreCase))  
            {  
                // Else ;  
                return true;  
            }  
        }  
        return false;  

Please help how to proceed ?

Wating for your fastest reply.

Ajay

0
Fiko
Telerik team
answered on 18 Dec 2009, 02:58 PM
Hello Ajay,

I am little bit confused with your code. In your first post I saw that you name the provider FTPCustomFileSystemProvider and I assumed that you use this code library as a base in your project. In the screenshots, however, I see that you use physical paths. Please note that since you use your own content provider (maybe based only on this KB article) and I need to take a closer look over your code in order to provide a solution of the problem.
Could you please open a new support ticket and send me a project that reproduces the problem? I will check it and do my best to provide a solutions as soon as possible.


Sincerely yours,
Fiko
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
FileExplorer
Asked by
Ajay
Top achievements
Rank 2
Answers by
Fiko
Telerik team
Ajay
Top achievements
Rank 2
Share this question
or