Tab
A newer version of this page is available. Switch to the current version.

FileManagerFolderAccessRule Class

Specifies an access rule for a folder within a file manager.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v18.2.dll

Declaration

public class FileManagerFolderAccessRule :
    FileManagerAccessRuleBase
Public Class FileManagerFolderAccessRule
    Inherits FileManagerAccessRuleBase

Remarks

ASPxFileManager allows you to define access permissions for folders and files using a set of folder/file access rules. Access rules for folders are denoted by FileManagerFolderAccessRule objects. The set of rules are contained within a file manager's FileManagerSettingsPermissions.AccessRules collection.

The FileManagerFolderAccessRule members allow you to specify a path (FileManagerAccessRuleBase.Path) and role (FileManagerAccessRuleBase.Role) to which a rule is applied, and lists permissions (allowed or denied actions) associated with this rule. You can specify permissions to browse a folder (FileManagerAccessRuleBase.Browse), edit a folder and its content (FileManagerAccessRuleBase.Edit), edit folder content only (FileManagerFolderAccessRule.EditContents), and upload files to a folder (FileManagerFolderAccessRule.Upload). The rule priority is determined by its index (CollectionItem.Index) within an access rules collection.

Concept

Example

WebForms (declaratively):

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

WebForms (in code):

ASPxFileManager fm = new ASPxFileManager();
...
FileManagerFileAccessRule fileRule = new FileManagerFileAccessRule();
fileRule.Path = "*.docx";
fileRule.Edit = Rights.Allow;
fileRule.Download = Rights.Allow;

FileManagerFolderAccessRule folderRule= new FileManagerFolderAccessRule();
folderRule.Role = "Administrator";
folderRule.EditContents = Rights.Allow;
folderRule.Browse = 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.Path = "*.docx";
    fileRule.Edit = Rights.Allow;
    fileRule.Download = Rights.Allow;

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

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

Online Demo

Inheritance

See Also