FileManagerFolderAccessRule Class
Specifies an access rule for a folder within a file manager.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v24.2.dll
Declaration
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 (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 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
Web Forms (in markup):
<dx:ASPxFileManager ID="ASPxFileManager1" runat="server">
<SettingsPermissions>
<AccessRules>
<dx:FileManagerFileAccessRule Edit="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.Edit = 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.Edit = 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()