Files
Disco/Disco.Web/Views/Device/DeviceParts/_Certificates.cshtml
Gary Sharp a099d68915 Permissions & Authorization for Users #24
Initial Release; Includes Database and MVC refactoring
2013-10-10 19:13:16 +11:00

56 lines
1.9 KiB
Plaintext

@model Disco.Web.Models.Device.ShowModel
@{
Authorization.Require(Claims.Device.ShowCertificates);
var hasDownloadCert = Authorization.Has(Claims.Config.DeviceCertificate.DownloadCertificates);
}
<div id="DeviceDetailTab-Certificates" class="DevicePart">
<div class="genericData certificateTable">
@if (Model.Certificates.Count() > 0)
{
<table class="genericData certificateTable">
<tr>
<th>Name
</th>
<th>Enabled
</th>
<th>Allocated
</th>
<th>Expires
</th>
</tr>
@foreach (var item in Model.Certificates)
{
<tr>
<td>
@if (hasDownloadCert)
{
@Html.ActionLink(item.Name, MVC.API.DeviceCertificate.Download(item.Id))
}
else
{
@item.Name
}
</td>
<td>
@item.Enabled
</td>
<td>
@CommonHelpers.FriendlyDate(item.AllocatedDate)
</td>
<td>
@CommonHelpers.FriendlyDate(item.ExpirationDate)
</td>
</tr>
}
</table>
}
else
{
<span class="smallMessage">No Certificates Allocated</span>
}
</div>
<script>
$('#DeviceDetailTabItems').append('<li><a href="#DeviceDetailTab-Certificates">Certificates [@(Model.Certificates.Count)]</a></li>');
</script>
</div>