FileManagerFolderAccessRule.Path Property
Gets or sets a folder path to which an access rule is applied.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v24.2.dll
NuGet Package: DevExpress.Web
#Declaration
#Property Value
Type | Default | Description |
---|---|---|
String | String. |
A String value that specifies a path relative to the root folder path defined by the File |
#Remarks
Use File Manager access rules (the FileManagerSettingsPermissions.AccessRules collection) to define a user’s access permissions for folders and files. A folder access rule specifies a permission that is an allowed or denied action associated with this rule. The Path
property specifies a folder path to which the rule is applied.
Set the FileManagerSettingsPermissions.Role property to specify the current user’s role. The specified role enforces access rules associated with this role.
Note
Only backslash (\
) path separator is allowed in the Path
property value.
The code samples below demonstrate how to use the Path
property.
Web Forms (in markup):
<dx:ASPxFileManager ID="ASPxFileManager1" runat="server">
<SettingsPermissions>
<AccessRules>
<dx:FileManagerFolderAccessRule Role="Administrator" Browse="Allow" Path="Documents" />
<dx:FileManagerFolderAccessRule Role="Administrator" EditContents="Allow" Path="Documents" />
</AccessRules>
</SettingsPermissions>
</dx:ASPxFileManager>
Web Forms (in code):
ASPxFileManager fm = new ASPxFileManager();
...
FileManagerFolderAccessRule folderRule = new FileManagerFolderAccessRule();
folderRule.Role = "Administrator";
folderRule.Path = "Documents";
folderRule.EditContents = Rights.Allow;
FileManager.SettingsPermissions.AccessRules.Add(folderRule);
...
MVC:
@Html.DevExpress().FileManager( settings => {
settings.Name = "fileManager";
FileManagerFolderAccessRule folderRule= new FileManagerFolderAccessRule();
folderRule.Role = "Administrator";
folderRule.Path = "Documents";
folderRule.EditContents = Rights.Allow;
FileManager.SettingsPermissions.AccessRules.Add(folderRule);
...
}).BindToFolder(Model).GetHtml()
#Concept
#Online Demo
#Example
The image below demonstrates the example’s file structure in the web site solution explorer and in the file manager.
The code sample below demonstrates an example of the ASPxFileManager control’s markup.
<dx:ASPxFileManager ID="ASPxFileManager1" runat="server" Width="700px">
<Settings RootFolder="~\Files\" ThumbnailFolder="~\Thumbnails\"
AllowedFileExtensions=".jpg, .jpeg, .gif, .rtf, .txt, .avi, .png, .mp3, .xml, .doc, .pdf" InitialFolder="Images\Employees" />
<SettingsEditing AllowCreate="True" AllowDelete="True" AllowMove="True" AllowRename="True" />
<SettingsPermissions>
<AccessRules>
<dx:FileManagerFolderAccessRule Edit="Deny" />
<dx:FileManagerFolderAccessRule Edit="Allow" Path="Documents\Reports" />
</AccessRules>
</SettingsPermissions>
</dx:ASPxFileManager>