feature: saved exports; include jobs and flags
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using Disco.Models.Repository;
|
||||
using Disco.Models.Services.Users.UserFlags;
|
||||
using Disco.Services;
|
||||
using Disco.Services.Authorization;
|
||||
using Disco.Services.Exporting;
|
||||
@@ -11,8 +10,6 @@ using Disco.Web.Areas.Config.Models.UserFlag;
|
||||
using Disco.Web.Extensions;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Caching;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace Disco.Web.Areas.API.Controllers
|
||||
@@ -411,6 +408,7 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
#region Exporting
|
||||
|
||||
[DiscoAuthorize(Claims.Config.UserFlag.Export)]
|
||||
[HttpPost, ValidateAntiForgeryToken]
|
||||
public virtual ActionResult Export(ExportModel Model)
|
||||
{
|
||||
if (Model == null || Model.Options == null)
|
||||
@@ -426,6 +424,7 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
else
|
||||
return RedirectToAction(MVC.Config.Logging.TaskStatus(taskContext.TaskStatus.SessionId));
|
||||
}
|
||||
|
||||
[DiscoAuthorize(Claims.Config.UserFlag.Export)]
|
||||
public virtual ActionResult ExportRetrieve(Guid id)
|
||||
{
|
||||
@@ -443,6 +442,16 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
return this.File(fileStream.GetBuffer(), 0, (int)fileStream.Length, context.Result.MimeType, context.Result.Filename);
|
||||
}
|
||||
|
||||
[DiscoAuthorizeAll(Claims.Config.ManageSavedExports, Claims.Config.UserFlag.Export)]
|
||||
[HttpPost, ValidateAntiForgeryToken]
|
||||
public virtual ActionResult SaveExport(ExportModel Model)
|
||||
{
|
||||
var export = new UserFlagExport(Model.Options);
|
||||
var savedExport = SavedExports.SaveExport(export, Database, CurrentUser);
|
||||
|
||||
return RedirectToAction(MVC.Config.Export.Create(savedExport.Id));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user