Files: fixed creating thirdparty room

This commit is contained in:
Maksim Chegulov 2023-01-25 13:06:59 +03:00
parent 7af94acd8b
commit 75f5832407
3 changed files with 40 additions and 9 deletions

View File

@ -532,15 +532,8 @@ public class FileStorageService<T> //: IFileStorageService
var parent = await folderDao.GetFolderAsync(parentId);
var providerInfo = await providerDao.GetProviderInfoAsync(parent.ProviderId);
if (providerInfo.RootFolderType != FolderType.VirtualRooms)
{
throw new InvalidDataException("Invalid provider type");
}
if (providerInfo.FolderId != null)
{
throw new InvalidOperationException("This provider already corresponds to the virtual room");
}
ErrorIf(providerInfo.RootFolderType != FolderType.VirtualRooms, FilesCommonResource.ErrorMessage_InvalidProvider);
ErrorIf(providerInfo.FolderId != null, FilesCommonResource.ErrorMessage_ProviderAlreadyConnect);
List<AceWrapper> aces = null;
@ -560,6 +553,8 @@ public class FileStorageService<T> //: IFileStorageService
_ => (await CreateCustomRoomAsync(title, parentId, @private), FolderType.CustomRoom),
};
ErrorIf(result.Item1.Id.Equals(result.Item1.RootId), FilesCommonResource.ErrorMessage_InvalidThirdPartyFolder);
if (@private)
{
await SetAcesForPrivateRoomAsync(result.Item1, aces, notify, sharingMessage);

View File

@ -771,6 +771,24 @@ namespace ASC.Files.Core.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Invalid provider.
/// </summary>
public static string ErrorMessage_InvalidProvider {
get {
return ResourceManager.GetString("ErrorMessage_InvalidProvider", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to It is not possible to use this folder to store the room.
/// </summary>
public static string ErrorMessage_InvalidThirdPartyFolder {
get {
return ResourceManager.GetString("ErrorMessage_InvalidThirdPartyFolder", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The invitation link is invalid or it&apos;s validity has expired.
/// </summary>
@ -789,6 +807,15 @@ namespace ASC.Files.Core.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to This provider is already connected to the room.
/// </summary>
public static string ErrorMessage_ProviderAlreadyConnect {
get {
return ResourceManager.GetString("ErrorMessage_ProviderAlreadyConnect", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to You don&apos;t have permission to copy to this folder.
/// </summary>

View File

@ -354,12 +354,21 @@
<data name="ErrorMassage_ViewTrashItem" xml:space="preserve">
<value>You are not allowed to preview the elements in the Trash</value>
</data>
<data name="ErrorMessage_InvalidProvider" xml:space="preserve">
<value>Invalid provider</value>
</data>
<data name="ErrorMessage_InvalidThirdPartyFolder" xml:space="preserve">
<value>It is not possible to use this folder to store the room</value>
</data>
<data name="ErrorMessage_InvintationLink" xml:space="preserve">
<value>The invitation link is invalid or it's validity has expired</value>
</data>
<data name="ErrorMessage_PaidRole" xml:space="preserve">
<value>The role is only available to a paid user</value>
</data>
<data name="ErrorMessage_ProviderAlreadyConnect" xml:space="preserve">
<value>This provider is already connected to the room</value>
</data>
<data name="ErrorMessage_SecurityException_CopyToFolder" xml:space="preserve">
<value>You don't have permission to copy to this folder</value>
</data>