FileManagerFolder.Permissions Property
Provides a set of permissions for the File Manager’s folder.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v24.1.dll
NuGet Package: DevExpress.Web
Declaration
Property Value
Type | Description |
---|---|
FileManagerFolderPermissions | One of the FileManagerFolderPermissions values. |
Available values:
Name | Description |
---|---|
Default | No permissions are specified for the folder. Access permissions for the folder are specified by the FileManagerSettingsPermissions.AccessRules property. |
Rename | Permits renaming a folder. |
Move | Permits moving a folder. |
Copy | Permits copying a folder. |
Delete | Permits deleting a folder. |
Create | Permits creating a child folder within the current one. |
Upload | Permits uploading files to a folder. |
MoveOrCopyInto | Permits moving or copying files and folders into the current folder. |
Remarks
To set the file permissions, use the FileManagerFolderProperties.Permissions property.
Refer to the Permissions topic to get more information on using the File Manager permissions.
Example
The following example illustrates how to specify permissions for files and folders within the ASPxFileManager.
public override FileManagerFilePermissions GetFilePermissions(FileManagerFile file) {
int fileId = int.Parse(file.Id);
Permissions permissions = Data.PermissionsSet.FirstOrDefault(p => p.Item.Id == fileId);
if(permissions == null)
return FileManagerFilePermissions.Default;
return GetFilePermissionsInternal(permissions);
}
public override FileManagerFolderPermissions GetFolderPermissions(FileManagerFolder folder) {
if(string.IsNullOrEmpty(folder.RelativeName))
return FileManagerFolderPermissions.Default;
int folderId = int.Parse(folder.Id);
Permissions permissions = Data.PermissionsSet.FirstOrDefault(p => p.Item.Id == folderId);
if(permissions == null)
return FileManagerFolderPermissions.Default;
return GetFolderPermissionsInternal(permissions);
}
FileManagerFilePermissions GetFilePermissionsInternal(Permissions permissions) {
return (permissions.Delete ? FileManagerFilePermissions.Delete : FileManagerFilePermissions.Default)
| (permissions.Move ? FileManagerFilePermissions.Move : FileManagerFilePermissions.Default)
| (permissions.Copy ? FileManagerFilePermissions.Copy : FileManagerFilePermissions.Default)
| (permissions.Rename ? FileManagerFilePermissions.Rename : FileManagerFilePermissions.Default)
| (permissions.Download ? FileManagerFilePermissions.Download : FileManagerFilePermissions.Default);
}
FileManagerFolderPermissions GetFolderPermissionsInternal(Permissions permissions) {
return (permissions.Delete ? FileManagerFolderPermissions.Delete : FileManagerFolderPermissions.Default)
| (permissions.Move ? FileManagerFolderPermissions.Move : FileManagerFolderPermissions.Default)
| (permissions.Copy ? FileManagerFolderPermissions.Copy : FileManagerFolderPermissions.Default)
| (permissions.Rename ? FileManagerFolderPermissions.Rename : FileManagerFolderPermissions.Default)
| (permissions.Create ? FileManagerFolderPermissions.Create : FileManagerFolderPermissions.Default)
| (permissions.Upload ? FileManagerFolderPermissions.Upload : FileManagerFolderPermissions.Default)
| (permissions.MoveOrCopyInto ? FileManagerFolderPermissions.MoveOrCopyInto : FileManagerFolderPermissions.Default);
}