Files: fix delete and readHistory for archive, added changeHistory

This commit is contained in:
pavelbannov 2022-12-02 15:02:42 +03:00
parent fa43e3deaf
commit 580c6688a3

View File

@ -724,11 +724,21 @@ public class FileSecurity : IFileSecurity
if ((e.RootFolderType == FolderType.VirtualRooms || e.RootFolderType == FolderType.Archive) && !isUser)
{
if (e.RootFolderType == FolderType.Archive && action != FilesSecurityActions.Read && action != FilesSecurityActions.Delete && action != FilesSecurityActions.RoomEdit)
if (e.RootFolderType == FolderType.Archive &&
action != FilesSecurityActions.Read &&
action != FilesSecurityActions.Delete &&
action != FilesSecurityActions.RoomEdit &&
action != FilesSecurityActions.ReadHistory
)
{
return false;
}
if (action == FilesSecurityActions.Delete && e.RootFolderType == FolderType.Archive && isDocSpaceAdmin)
{
return folder != null && DocSpaceHelper.IsRoom(folder.FolderType);
}
if (isDocSpaceAdmin || e.CreateBy == userId)
{
return true;
@ -741,6 +751,7 @@ public class FileSecurity : IFileSecurity
{
return true;
}
}
if (e.RootFolderType == FolderType.ThirdpartyBackup && isDocSpaceAdmin)
@ -748,11 +759,6 @@ public class FileSecurity : IFileSecurity
return true;
}
if (action == FilesSecurityActions.Delete && e.RootFolderType == FolderType.Archive && isDocSpaceAdmin)
{
return true;
}
if (action == FilesSecurityActions.RoomEdit && e.RootFolderType == FolderType.Archive && isDocSpaceAdmin)
{
return true;
@ -829,8 +835,13 @@ public class FileSecurity : IFileSecurity
{
return true;
}
else if (action == FilesSecurityActions.Edit && (e.Access == FileShare.ReadWrite || e.Access == FileShare.RoomAdmin || e.Access == FileShare.Editing) && e.RootFolderType != FolderType.Archive)
else if ((action == FilesSecurityActions.Edit || action == FilesSecurityActions.ChangeHistory) && (e.Access == FileShare.ReadWrite || e.Access == FileShare.RoomAdmin || e.Access == FileShare.Editing) && e.RootFolderType != FolderType.Archive)
{
if (action == FilesSecurityActions.ChangeHistory)
{
return file != null && !file.Encrypted;
}
return true;
}
else if (action == FilesSecurityActions.Rename && (e.Access == FileShare.ReadWrite || e.Access == FileShare.RoomAdmin) && e.RootFolderType != FolderType.Archive)
@ -845,7 +856,7 @@ public class FileSecurity : IFileSecurity
{
return true;
}
else if (action == FilesSecurityActions.ReadHistory && (e.Access == FileShare.RoomAdmin || e.Access == FileShare.Editing) && e.RootFolderType != FolderType.Archive)
else if (action == FilesSecurityActions.ReadHistory && (e.Access == FileShare.RoomAdmin || e.Access == FileShare.Editing))
{
return true;
}
@ -1584,6 +1595,7 @@ public class FileSecurity : IFileSecurity
RoomEdit,
Rename,
ReadHistory,
Lock
Lock,
ChangeHistory
}
}