Add permissions for downloading LeafInput
This commit is contained in:
@@ -40,7 +40,7 @@ else
|
||||
null,
|
||||
new {id="register-member"}))
|
||||
{
|
||||
@Html.ValidationSummary(true)
|
||||
@Html.ValidationSummary(false)
|
||||
<ul class="d-none">
|
||||
@foreach (var ms in ViewData.ModelState)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
@using LeafWeb.WebCms.Utility
|
||||
@model LeafInputDetails
|
||||
@{
|
||||
var username = HttpContext.Current.User.Identity.Name;
|
||||
}
|
||||
|
||||
<div class="row pb-3">
|
||||
|
||||
@@ -10,6 +13,8 @@
|
||||
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<span class="fa fa-download"></span> Download
|
||||
</button>
|
||||
@if (string.Equals(Model.Email, username, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
<div class="dropdown-menu" aria-labelledby="downloadButton">
|
||||
<a href="@Url.Action("Input", "Download", new {id = Model.LeafInputId})"
|
||||
class="dropdown-item">
|
||||
@@ -17,9 +22,10 @@
|
||||
</a>
|
||||
<a href="@Url.Action("OutputToUser", "Download", new {id = Model.LeafInputId})"
|
||||
class="dropdown-item @if (!Model.HasOutputFiles) {<text> disabled</text>}">
|
||||
ToUser
|
||||
Output
|
||||
</a>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -40,15 +46,3 @@
|
||||
}
|
||||
@Html.Partial("DisplayTemplates/_ChartLink", (int)item.LeafInputId, cssClass)
|
||||
}
|
||||
|
||||
|
||||
@helper CancelLink(LeafInputDetails_Admin item)
|
||||
{
|
||||
var cssClass
|
||||
= CssClassUtil.CreateCssClassDataDictionary("btn", "btn-outline-secondary");
|
||||
if (!item.IsCancellable)
|
||||
{
|
||||
cssClass.SetCssDisabled();
|
||||
}
|
||||
@Html.Partial("DisplayTemplates/_CancelForm", Tuple.Create(item.LeafInputId, item.Identifier), cssClass)
|
||||
}
|
||||
@@ -35,10 +35,10 @@
|
||||
</div>
|
||||
<div class="row justify-content-end">
|
||||
<div class="col-sm">@grid.PagerList()</div>
|
||||
<div class="col-sm col-lg-5 pl-4 pt-3 pt-sm-0">
|
||||
@*<div class="col-sm col-lg-5 pl-4 pt-3 pt-sm-0">
|
||||
<span class="pr-2">Download Results</span>
|
||||
@DownloadResults()
|
||||
</div>
|
||||
</div>*@
|
||||
</div>
|
||||
}
|
||||
else
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
@{
|
||||
ViewBag.Title = "Permission Denied";
|
||||
}
|
||||
|
||||
<h1>
|
||||
@ViewBag.Title
|
||||
</h1>
|
||||
|
||||
<p>Permission denied for requested resource. If you believe this to be in error please contact administrator, referencing the following url:</p>
|
||||
<code>@Html.Raw(Request.Url)</code>
|
||||
@@ -1,8 +1,10 @@
|
||||
@using LeafWeb.Core.Entities
|
||||
@using LeafWeb.WebCms.Utility
|
||||
|
||||
@model LeafInput
|
||||
@{
|
||||
var admin = ViewData.ContainsKey("admin");
|
||||
var username = HttpContext.Current.User.Identity.Name;
|
||||
}
|
||||
|
||||
<div class="btn-group text-nowrap" role="group">
|
||||
@@ -15,33 +17,38 @@
|
||||
@if (admin)
|
||||
{
|
||||
@Details_AdminLink(Model)
|
||||
@ChartLink(Model)
|
||||
if (Model.IsPending)
|
||||
{
|
||||
<div class="dropdown-divider"></div>
|
||||
<h6 class="dropdown-header">Priority</h6>
|
||||
<button class="dropdown-item @DisableItem(Model.PendingPriority == Priority.High)">@PriorityForm(Model, Priority.High)</button>
|
||||
<button class="dropdown-item @DisableItem(Model.PendingPriority == Priority.Normal)">@PriorityForm(Model, Priority.Normal)</button>
|
||||
<button class="dropdown-item @DisableItem(Model.PendingPriority == Priority.Low)">@PriorityForm(Model, Priority.Low)</button>
|
||||
}
|
||||
if (Model.IsCancellable)
|
||||
{
|
||||
<div class="dropdown-divider"></div>
|
||||
@CancelLink(Model)
|
||||
}
|
||||
<div class="dropdown-divider"></div>
|
||||
<h6 class="dropdown-header">Download</h6>
|
||||
@DownloadInput(Model)
|
||||
@DownloadOutputToUser(Model)
|
||||
<div class="dropdown-divider"></div>
|
||||
@DeleteLink(Model)
|
||||
}
|
||||
else
|
||||
{
|
||||
@Details_ResultsLink(Model)
|
||||
}
|
||||
@ChartLink(Model)
|
||||
@if (admin && Model.IsPending)
|
||||
{
|
||||
<div class="dropdown-divider"></div>
|
||||
<h6 class="dropdown-header">Priority</h6>
|
||||
<button class="dropdown-item @DisableItem(Model.PendingPriority == Priority.High)">@PriorityForm(Model, Priority.High)</button>
|
||||
<button class="dropdown-item @DisableItem(Model.PendingPriority == Priority.Normal)">@PriorityForm(Model, Priority.Normal)</button>
|
||||
<button class="dropdown-item @DisableItem(Model.PendingPriority == Priority.Low)">@PriorityForm(Model, Priority.Low)</button>
|
||||
}
|
||||
@if (admin && Model.IsCancellable)
|
||||
{
|
||||
<div class="dropdown-divider"></div>
|
||||
@CancelLink(Model)
|
||||
}
|
||||
<div class="dropdown-divider"></div>
|
||||
<h6 class="dropdown-header">Download</h6>
|
||||
@DownloadInput(Model)
|
||||
@DownloadOutputToUser(Model)
|
||||
@if (admin)
|
||||
{
|
||||
<div class="dropdown-divider"></div>
|
||||
@DeleteLink(Model)
|
||||
@ChartLink(Model)
|
||||
if (string.Equals(Model.Email, username, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
<div class="dropdown-divider"></div>
|
||||
<h6 class="dropdown-header">Download</h6>
|
||||
@DownloadInput(Model)
|
||||
@DownloadOutputToUser(Model)
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@@ -81,7 +88,7 @@
|
||||
@helper DownloadOutputToUser(dynamic item)
|
||||
{
|
||||
<a href="@Url.Action("OutputToUser", "Download", new {id = item.Id})" class="dropdown-item @DisableItem(!item.HasOutputFiles)">
|
||||
<span class="fa fa-download"></span> ToUser
|
||||
<span class="fa fa-download"></span> Output
|
||||
</a>
|
||||
}
|
||||
@helper DeleteLink(LeafInput item)
|
||||
|
||||
Reference in New Issue
Block a user