Пример #1
0
        public async Task <IActionResult> DeleteFolder(string path)
        {
            if (!await _authorizationService.AuthorizeAsync(User, Permissions.ManageOwnMedia))
            {
                return(Unauthorized());
            }

            if (string.IsNullOrEmpty(path))
            {
                return(StatusCode(StatusCodes.Status403Forbidden, "Cannot delete root media folder"));
            }

            var mediaFolder = await _mediaFileStore.GetFolderAsync(path);

            if (mediaFolder == null || !mediaFolder.IsDirectory)
            {
                return(StatusCode(StatusCodes.Status403Forbidden, "Cannot delete path"));
            }

            await _mediaFileStore.TryDeleteFolderAsync(path);

            return(Ok());
        }