Skip to main content
Tab

FileManagerFolderAccessRule.EditContents Property

Gets or sets the edit contents action permission.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v23.2.dll

NuGet Package: DevExpress.Web

Declaration

[DefaultValue(Rights.Default)]
public Rights EditContents { 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 EditContents property to specify whether end-users with the specified role (FileManagerAccessRuleBase.Role) can edit contents of a folder(s) specified in the current access rule (via the Path property).

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()

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