packaging+fs

This commit is contained in:
2019-08-21 17:23:58 +01:00
parent 9a17dcf017
commit 0a6bb634b9
21 changed files with 95 additions and 66 deletions

View File

@ -11,7 +11,7 @@ namespace Yavsc.ApiControllers
{
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Yavsc.Abstract.FileSystem;
using Yavsc.Helpers;
using Yavsc.Exceptions;
using Yavsc.Models.FileSystem;
@ -48,7 +48,7 @@ namespace Yavsc.ApiControllers
if (subdir !=null)
if (!subdir.IsValidYavscPath())
return new BadRequestResult();
var files = User.GetUserFiles(subdir);
var files = AbstractFileSystemHelpers.GetUserFiles(User.Identity.Name, subdir);
return Ok(files);
}
@ -89,7 +89,7 @@ namespace Yavsc.ApiControllers
return Ok(received);
}
[Route("/api/addquota/{len}")]
[Route("/api/fs/addquota/{len}")]
[Authorize("AdministratorOnly")]
public IActionResult AddQuota(int len)
{
@ -102,6 +102,19 @@ namespace Yavsc.ApiControllers
return Ok(len);
}
[Route("/api/fs/move")]
[Authorize()]
public IActionResult Move(string from, string to)
{
var uid = User.GetUserId();
var user = dbContext.Users.Single(
u => u.Id == uid
);
return Ok();
}
[HttpDelete]
public async Task <IActionResult> Delete (string id)
{

View File

@ -2,26 +2,25 @@ using System.IO;
using Microsoft.AspNet.Authorization;
using Microsoft.AspNet.Mvc;
using System.Web.Routing;
using System.Linq;
using Microsoft.Data.Entity;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.OptionsModel;
using System;
using System.Security.Claims;
using System.Linq;
using Microsoft.Data.Entity;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.OptionsModel;
using Newtonsoft.Json;
using System;
using System.Security.Claims;
using Yavsc.Helpers;
using Yavsc.ViewModels;
namespace Yavsc.ApiControllers
{
using Models;
using Helpers;
using Services;
using Models.Messaging;
using ViewModels.Auth;
using Newtonsoft.Json;
using Yavsc.ViewModels;
using Yavsc.Abstract.FileSystem;
[Route("api/bill"), Authorize]
public class BillingController : Controller
@ -144,7 +143,7 @@ namespace Yavsc.ApiControllers
return new ChallengeResult();
}
var filename = FileSystemHelpers.SignFileNameFormat("pro",billingCode,id);
var filename = AbstractFileSystemHelpers.SignFileNameFormat("pro", billingCode, id);
FileInfo fi = new FileInfo(Path.Combine(AbstractFileSystemHelpers.UserBillsDirName, filename));
if (!fi.Exists) return HttpNotFound(new { Error = "Professional signature not found" });
return File(fi.OpenRead(), "application/x-pdf", filename); ;
@ -179,7 +178,7 @@ namespace Yavsc.ApiControllers
return new ChallengeResult();
}
var filename = FileSystemHelpers.SignFileNameFormat("pro",billingCode,id);
var filename = AbstractFileSystemHelpers.SignFileNameFormat("pro", billingCode, id);
FileInfo fi = new FileInfo(Path.Combine(AbstractFileSystemHelpers.UserBillsDirName, filename));
if (!fi.Exists) return HttpNotFound(new { Error = "Professional signature not found" });
return File(fi.OpenRead(), "application/x-pdf", filename); ;