Skip to main content
All docs
V24.2
Tab

FileManagerFileAccessRule.PathPattern Property

Gets or sets a pattern for file paths to which an access rule is applied.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.2.dll

Declaration

[DefaultValue("")]
public string PathPattern { get; set; }

Property Value

Type Default Description
String String.Empty

A String value that specifies a pattern for file paths relative to the root folder path defined by the FileManagerSettings.RootFolder property.

Remarks

Use File Manager access rules (the FileManagerSettingsPermissions.AccessRules collection) to define a user’s access permissions for folders and files. A file access rule specifies a permission that is an allowed or denied action associated with this rule. The PathPattern property specifies file paths to which the rule is applied. The property value can contain a wildcard character (*), which denotes any sequence of characters.

Set the FileManagerSettingsPermissions.Role property to specify the current user’s role. The specified role enforces access rules associated with this role.

The code samples below demonstrate how to use the PathPattern property.

Web Forms (in markup):

<dx:ASPxFileManager ID="ASPxFileManager1" runat="server">    
    <SettingsPermissions>
        <AccessRules>
            <dx:FileManagerFileAccessRule FullAccess="Allow" PathPattern="*.docx" />
        </AccessRules>
    </SettingsPermissions>
</dx:ASPxFileManager>

Web Forms (in code):

ASPxFileManager fm = new ASPxFileManager();
...
FileManagerFileAccessRule fileRule = new FileManagerFileAccessRule();
fileRule.PathPattern = "*.docx";
fileRule.FullAccess = Rights.Allow;

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

MVC:

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

    FileManagerFileAccessRule fileRule = new FileManagerFileAccessRule();
    fileRule.PathPattern = "*.docx";
    fileRule.FullAccess = Rights.Allow;

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

Concept

Online Demo

Example

<dx:ASPxFileManager ID="FileManager" runat="server" ...>

...

     <SettingsPermissions>
          <AccessRules>
               <dx:FileManagerFolderAccessRule Path="" Edit="Deny" />
               <dx:FileManagerFileAccessRule PathPattern="*.xml" Edit="Deny" />
               <dx:FileManagerFolderAccessRule Path="System" Browse="Deny" />

               <dx:FileManagerFolderAccessRule Path="Documents" Role="DocumentManager" EditContents="Allow" />

               <dx:FileManagerFolderAccessRule Path="Music" Role="MediaModerator" EditContents="Allow" />
               <dx:FileManagerFolderAccessRule Path="Video" Role="MediaModerator" EditContents="Allow" />
               <dx:FileManagerFolderAccessRule Path="" Role="MediaModerator" Upload="Deny" />

               <dx:FileManagerFolderAccessRule Role="Administrator" Browse="Allow" />
               <dx:FileManagerFolderAccessRule Role="Administrator" Edit="Allow" />
          </AccessRules>
     </SettingsPermissions>
</dx:ASPxFileManager>
See Also