Skip to main content
Tab

FileManagerFileAccessRule.Download Property

Gets or sets the download action permission.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v23.2.dll

NuGet Package: DevExpress.Web

Declaration

[DefaultValue(Rights.Default)]
public Rights Download { get; set; }

Property Value

Type Default Description
Rights Default

One of the Rights enumeration values specifying the action permission.

Available values:

Name Description
Allow

The action is allowed within the access rule.

Deny

The action is denied within the access rule.

Default

The action has an identical permission as the current item (file or folder) parent element. It corresponds to the Rights.Allow permission if this value does not exist.

Remarks

ASPxFileManager allows you to define access permissions for folders and files using a set of file/folder access rules (FileManagerSettingsPermissions.AccessRules). An access rule specifies a path to which it is applied and lists permissions (allowed or denied actions) associated with this rule.

Use the Download property to specify whether users with the specified role (Role) can download a file(s) specified in the current access rule (via the FileManagerFileAccessRule.PathPattern property).

Concept

Example

Web Forms (in markup):

<dx:ASPxFileManager ID="ASPxFileManager1" runat="server">    
    <SettingsPermissions>
        <AccessRules>
            <dx:FileManagerFileAccessRule Download="Deny" PathPattern="*.docx" />
            <dx:FileManagerFolderAccessRule Role="Administrator" EditContents="Allow" Path="Documents" />
        </AccessRules>
    </SettingsPermissions>
</dx:ASPxFileManager>

Web Forms (in code):

ASPxFileManager fm = new ASPxFileManager();
...
FileManagerFileAccessRule fileRule = new FileManagerFileAccessRule();
fileRule.PathPattern = "*.docx";
fileRule.Download = Rights.Deny;

FileManagerFolderAccessRule folderRule= new FileManagerFolderAccessRule();
folderRule.Role = "Administrator";
folderRule.EditContents = Rights.Allow;

FileManager.SettingsPermissions.AccessRules.Add(fileRule);
FileManager.SettingsPermissions.AccessRules.Add(folderRule);
...

MVC:

@Html.DevExpress().FileManager( settings => {
    settings.Name = "fileManager";

    FileManagerFileAccessRule fileRule = new FileManagerFileAccessRule();
    fileRule.PathPattern = "*.docx";
    fileRule.Download = Rights.Deny;

    FileManagerFolderAccessRule folderRule= new FileManagerFolderAccessRule();
    folderRule.Role = "Administrator";
    folderRule.EditContents = Rights.Allow;

    FileManager.SettingsPermissions.AccessRules.Add(fileRule);
    FileManager.SettingsPermissions.AccessRules.Add(folderRule);
    ...
}).BindToFolder(Model).GetHtml()

Online Demo

See Also