fixed Bug 61882

This commit is contained in:
Maksim Chegulov 2023-04-03 12:21:36 +03:00
parent 1fa94b04a8
commit 137ae55648
3 changed files with 43 additions and 9 deletions

View File

@ -842,6 +842,15 @@ namespace ASC.Files.Core.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to You don&apos;t have enough permission to archive the room.
/// </summary>
public static string ErrorMessage_SecurityException_ArchiveRoom {
get {
return ResourceManager.GetString("ErrorMessage_SecurityException_ArchiveRoom", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to You don&apos;t have permission to copy to this folder. /// Looks up a localized string similar to You don&apos;t have permission to copy to this folder.
/// </summary> /// </summary>
@ -870,11 +879,11 @@ namespace ASC.Files.Core.Resources {
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to You don&apos;t have enough permission to archive the room. /// Looks up a localized string similar to You don&apos;t have enough permission to unarchive the room.
/// </summary> /// </summary>
public static string ErrorMessage_UnarchiveRoom { public static string ErrorMessage_SecurityException_UnarchiveRoom {
get { get {
return ResourceManager.GetString("ErrorMessage_UnarchiveRoom", resourceCulture); return ResourceManager.GetString("ErrorMessage_SecurityException_UnarchiveRoom", resourceCulture);
} }
} }

View File

@ -375,8 +375,8 @@
<data name="ErrorMessage_SecurityException_MoveToFolder" xml:space="preserve"> <data name="ErrorMessage_SecurityException_MoveToFolder" xml:space="preserve">
<value>You don't have permission to move to this folder</value> <value>You don't have permission to move to this folder</value>
</data> </data>
<data name="ErrorMessage_UnarchiveRoom" xml:space="preserve"> <data name="ErrorMessage_SecurityException_UnarchiveRoom" xml:space="preserve">
<value>You don't have enough permission to archive the room</value> <value>You don't have enough permission to unarchive the room</value>
</data> </data>
<data name="ErrorMessage_UpdateArchivedRoom" xml:space="preserve"> <data name="ErrorMessage_UpdateArchivedRoom" xml:space="preserve">
<value>You cannot edit archived rooms</value> <value>You cannot edit archived rooms</value>
@ -472,4 +472,7 @@ Highest compatibility with docx, xlsx, pptx. </value>
<data name="AceStatusEnum_Collaborator" xml:space="preserve"> <data name="AceStatusEnum_Collaborator" xml:space="preserve">
<value>Collaborator</value> <value>Collaborator</value>
</data> </data>
<data name="ErrorMessage_SecurityException_ArchiveRoom" xml:space="preserve">
<value>You don't have enough permission to archive the room</value>
</data>
</root> </root>

View File

@ -146,6 +146,7 @@ class FileMoveCopyOperation<T> : FileOperation<FileMoveCopyOperationData<T>, T>
if (0 < Folders.Count) if (0 < Folders.Count)
{ {
var firstFolder = await FolderDao.GetFolderAsync(Folders[0]); var firstFolder = await FolderDao.GetFolderAsync(Folders[0]);
var isRoom = DocSpaceHelper.IsRoom(firstFolder.FolderType);
if (_copy && !await FilesSecurity.CanCopyAsync(firstFolder)) if (_copy && !await FilesSecurity.CanCopyAsync(firstFolder))
{ {
@ -155,7 +156,17 @@ class FileMoveCopyOperation<T> : FileOperation<FileMoveCopyOperationData<T>, T>
} }
if (!_copy && !await FilesSecurity.CanMoveAsync(firstFolder)) if (!_copy && !await FilesSecurity.CanMoveAsync(firstFolder))
{ {
this[Err] = FilesCommonResource.ErrorMassage_SecurityException_MoveFile; if (isRoom)
{
this[Err] = toFolder.FolderType == FolderType.Archive
? FilesCommonResource.ErrorMessage_SecurityException_ArchiveRoom
: FilesCommonResource.ErrorMessage_SecurityException_UnarchiveRoom;
}
else
{
this[Err] = FilesCommonResource.ErrorMassage_SecurityException_MoveFolder;
}
return; return;
} }
@ -187,7 +198,9 @@ class FileMoveCopyOperation<T> : FileOperation<FileMoveCopyOperationData<T>, T>
} }
if (!_copy && !await fileSecurity.CanMoveToAsync(toFolder)) if (!_copy && !await fileSecurity.CanMoveToAsync(toFolder))
{ {
this[Err] = FilesCommonResource.ErrorMessage_SecurityException_MoveToFolder; this[Err] = toFolder.FolderType == FolderType.VirtualRooms ? FilesCommonResource.ErrorMessage_SecurityException_UnarchiveRoom :
toFolder.FolderType == FolderType.Archive ? FilesCommonResource.ErrorMessage_SecurityException_UnarchiveRoom :
FilesCommonResource.ErrorMessage_SecurityException_MoveToFolder;
return; return;
} }
@ -270,7 +283,16 @@ class FileMoveCopyOperation<T> : FileOperation<FileMoveCopyOperationData<T>, T>
} }
else if (!copy && checkPermissions && !canMoveOrCopy) else if (!copy && checkPermissions && !canMoveOrCopy)
{ {
this[Err] = FilesCommonResource.ErrorMassage_SecurityException_MoveFolder; if (isRoom)
{
this[Err] = toFolder.FolderType == FolderType.Archive
? FilesCommonResource.ErrorMessage_SecurityException_ArchiveRoom
: FilesCommonResource.ErrorMessage_SecurityException_UnarchiveRoom;
}
else
{
this[Err] = FilesCommonResource.ErrorMassage_SecurityException_MoveFolder;
}
} }
else if (!isRoom && (toFolder.FolderType == FolderType.VirtualRooms || toFolder.RootFolderType == FolderType.Archive)) else if (!isRoom && (toFolder.FolderType == FolderType.VirtualRooms || toFolder.RootFolderType == FolderType.Archive))
{ {
@ -278,7 +300,7 @@ class FileMoveCopyOperation<T> : FileOperation<FileMoveCopyOperationData<T>, T>
} }
else if (isRoom && toFolder.FolderType != FolderType.VirtualRooms && toFolder.FolderType != FolderType.Archive) else if (isRoom && toFolder.FolderType != FolderType.VirtualRooms && toFolder.FolderType != FolderType.Archive)
{ {
this[Err] = FilesCommonResource.ErrorMessage_UnarchiveRoom; this[Err] = FilesCommonResource.ErrorMessage_SecurityException_UnarchiveRoom;
} }
else if (!isRoom && folder.Private && !await CompliesPrivateRoomRulesAsync(folder, toFolderParents)) else if (!isRoom && folder.Private && !await CompliesPrivateRoomRulesAsync(folder, toFolderParents))
{ {