Permissions & Authorization for Users #24
Initial Release; Includes Database and MVC refactoring
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.18033
|
||||
// Runtime Version:4.0.30319.18051
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
@@ -28,12 +28,14 @@ namespace Disco.Web.Views.Device
|
||||
using System.Web.WebPages;
|
||||
using Disco.BI.Extensions;
|
||||
using Disco.Models.Repository;
|
||||
using Disco.Services.Authorization;
|
||||
using Disco.Services.Web;
|
||||
using Disco.Web;
|
||||
using Disco.Web.Extensions;
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
|
||||
[System.Web.WebPages.PageVirtualPathAttribute("~/Views/Device/AddOffline.cshtml")]
|
||||
public partial class AddOffline : System.Web.Mvc.WebViewPage<Disco.Web.Models.Device.AddOfflineModel>
|
||||
public partial class AddOffline : Disco.Services.Web.WebViewPage<Disco.Web.Models.Device.AddOfflineModel>
|
||||
{
|
||||
public AddOffline()
|
||||
{
|
||||
@@ -43,15 +45,24 @@ namespace Disco.Web.Views.Device
|
||||
|
||||
#line 2 "..\..\Views\Device\AddOffline.cshtml"
|
||||
|
||||
Authorization.Require(Claims.Device.Actions.EnrolDevices);
|
||||
|
||||
ViewBag.Title = Html.ToBreadcrumb("Devices", MVC.Device.Index(), "Add Offline");
|
||||
|
||||
var hasAssetNumber = Authorization.Has(Claims.Device.Properties.AssetNumber);
|
||||
var hasLocation = Authorization.Has(Claims.Device.Properties.Location);
|
||||
var hasDeviceBatch = Authorization.Has(Claims.Device.Properties.DeviceBatch);
|
||||
var hasDeviceProfile = Authorization.Has(Claims.Device.Properties.DeviceProfile);
|
||||
var hasAssignUser = Authorization.Has(Claims.Device.Actions.AssignUser);
|
||||
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n");
|
||||
|
||||
|
||||
#line 5 "..\..\Views\Device\AddOffline.cshtml"
|
||||
#line 14 "..\..\Views\Device\AddOffline.cshtml"
|
||||
using (Html.BeginForm())
|
||||
{
|
||||
|
||||
@@ -59,14 +70,14 @@ WriteLiteral("\r\n");
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 7 "..\..\Views\Device\AddOffline.cshtml"
|
||||
#line 16 "..\..\Views\Device\AddOffline.cshtml"
|
||||
Write(Html.ValidationSummary(true));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 7 "..\..\Views\Device\AddOffline.cshtml"
|
||||
#line 16 "..\..\Views\Device\AddOffline.cshtml"
|
||||
|
||||
|
||||
|
||||
@@ -78,13 +89,13 @@ WriteLiteral(" class=\"form\"");
|
||||
|
||||
WriteLiteral(" style=\"width: 450px\"");
|
||||
|
||||
WriteLiteral(">\r\n <table>\r\n <tr>\r\n <th>\r\n S" +
|
||||
"erial Number:\r\n </th>\r\n <td>\r\n");
|
||||
WriteLiteral(">\r\n <table>\r\n <tr>\r\n <th>Serial Number:\r\n " +
|
||||
" </th>\r\n <td>\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 15 "..\..\Views\Device\AddOffline.cshtml"
|
||||
#line 23 "..\..\Views\Device\AddOffline.cshtml"
|
||||
Write(Html.TextBoxFor(model => model.Device.SerialNumber));
|
||||
|
||||
|
||||
@@ -95,132 +106,260 @@ WriteLiteral("<br />\r\n");
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 16 "..\..\Views\Device\AddOffline.cshtml"
|
||||
#line 24 "..\..\Views\Device\AddOffline.cshtml"
|
||||
Write(Html.ValidationMessageFor(model => model.Device.SerialNumber));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th" +
|
||||
">\r\n Asset Number:\r\n </th>\r\n <td" +
|
||||
">");
|
||||
WriteLiteral("\r\n </td>\r\n </tr>\r\n");
|
||||
|
||||
|
||||
#line 23 "..\..\Views\Device\AddOffline.cshtml"
|
||||
Write(Html.TextBoxFor(model => model.Device.AssetNumber));
|
||||
#line 27 "..\..\Views\Device\AddOffline.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 27 "..\..\Views\Device\AddOffline.cshtml"
|
||||
if (hasAssetNumber)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("<br />\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 24 "..\..\Views\Device\AddOffline.cshtml"
|
||||
Write(Html.ValidationMessageFor(model => model.Device.AssetNumber));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th" +
|
||||
">\r\n Location:\r\n </th>\r\n <td>");
|
||||
|
||||
|
||||
#line 31 "..\..\Views\Device\AddOffline.cshtml"
|
||||
Write(Html.TextBoxFor(model => model.Device.Location));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("<br />\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
WriteLiteral(" <tr>\r\n <th>Asset Number:\r\n " +
|
||||
"</th>\r\n <td>");
|
||||
|
||||
|
||||
#line 32 "..\..\Views\Device\AddOffline.cshtml"
|
||||
Write(Html.ValidationMessageFor(model => model.Device.Location));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th" +
|
||||
">\r\n Device Batch:\r\n </th>\r\n <td" +
|
||||
">\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 40 "..\..\Views\Device\AddOffline.cshtml"
|
||||
Write(Html.DropDownListFor(model => model.Device.DeviceBatchId, Model.DeviceBatches.ToSelectListItems()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <br />\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 41 "..\..\Views\Device\AddOffline.cshtml"
|
||||
Write(Html.ValidationMessageFor(model => model.Device.DeviceBatchId));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th" +
|
||||
">\r\n Device Profile:\r\n </th>\r\n <" +
|
||||
"td>\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 49 "..\..\Views\Device\AddOffline.cshtml"
|
||||
Write(Html.DropDownListFor(model => model.Device.DeviceProfileId, Model.DeviceProfiles.ToSelectListItems(Model.DefaultDeviceProfileId)));
|
||||
Write(Html.TextBoxFor(model => model.Device.AssetNumber));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("<br />\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 50 "..\..\Views\Device\AddOffline.cshtml"
|
||||
Write(Html.ValidationMessageFor(model => model.Device.DeviceProfileId));
|
||||
#line 33 "..\..\Views\Device\AddOffline.cshtml"
|
||||
Write(Html.ValidationMessageFor(model => model.Device.AssetNumber));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th" +
|
||||
">\r\n Assigned User:\r\n </th>\r\n <t" +
|
||||
"d>\r\n");
|
||||
WriteLiteral("\r\n </td>\r\n </tr>\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
#line 36 "..\..\Views\Device\AddOffline.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 37 "..\..\Views\Device\AddOffline.cshtml"
|
||||
if (hasLocation)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <tr>\r\n <th>Location:\r\n </th" +
|
||||
">\r\n <td>");
|
||||
|
||||
|
||||
#line 42 "..\..\Views\Device\AddOffline.cshtml"
|
||||
Write(Html.TextBoxFor(model => model.Device.Location));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("<br />\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 43 "..\..\Views\Device\AddOffline.cshtml"
|
||||
Write(Html.ValidationMessageFor(model => model.Device.Location));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n </td>\r\n </tr>\r\n");
|
||||
|
||||
|
||||
#line 46 "..\..\Views\Device\AddOffline.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 47 "..\..\Views\Device\AddOffline.cshtml"
|
||||
if (hasDeviceBatch)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <tr>\r\n <th>Device Batch:\r\n " +
|
||||
"</th>\r\n <td>\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 53 "..\..\Views\Device\AddOffline.cshtml"
|
||||
Write(Html.DropDownListFor(model => model.Device.DeviceBatchId, Model.DeviceBatches.ToSelectListItems()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n <br />\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 55 "..\..\Views\Device\AddOffline.cshtml"
|
||||
Write(Html.ValidationMessageFor(model => model.Device.DeviceBatchId));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n </td>\r\n </tr>\r\n");
|
||||
|
||||
|
||||
#line 58 "..\..\Views\Device\AddOffline.cshtml"
|
||||
Write(Html.TextBoxFor(model => model.Device.AssignedUserId));
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 59 "..\..\Views\Device\AddOffline.cshtml"
|
||||
if (hasDeviceProfile)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <tr>\r\n <th>Device Profile:\r\n " +
|
||||
" </th>\r\n <td>\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 65 "..\..\Views\Device\AddOffline.cshtml"
|
||||
Write(Html.DropDownListFor(model => model.Device.DeviceProfileId, Model.DeviceProfiles.ToSelectListItems(Model.DefaultDeviceProfileId)));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("<br />\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 59 "..\..\Views\Device\AddOffline.cshtml"
|
||||
Write(Html.ValidationMessageFor(model => model.Device.AssignedUserId));
|
||||
#line 66 "..\..\Views\Device\AddOffline.cshtml"
|
||||
Write(Html.ValidationMessageFor(model => model.Device.DeviceProfileId));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n </td>\r\n </tr>\r\n </table>\r\n <p");
|
||||
WriteLiteral("\r\n </td>\r\n </tr>\r\n");
|
||||
|
||||
|
||||
#line 69 "..\..\Views\Device\AddOffline.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 70 "..\..\Views\Device\AddOffline.cshtml"
|
||||
if (hasAssignUser)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <tr>\r\n <th>Assigned User:\r\n " +
|
||||
" </th>\r\n <td>\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 76 "..\..\Views\Device\AddOffline.cshtml"
|
||||
Write(Html.TextBoxFor(model => model.Device.AssignedUserId));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("<br />\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 77 "..\..\Views\Device\AddOffline.cshtml"
|
||||
Write(Html.ValidationMessageFor(model => model.Device.AssignedUserId));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n </td>\r\n </tr>\r\n");
|
||||
|
||||
|
||||
#line 80 "..\..\Views\Device\AddOffline.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" </table>\r\n <p");
|
||||
|
||||
WriteLiteral(" class=\"actions\"");
|
||||
|
||||
WriteLiteral(">\r\n <input");
|
||||
WriteLiteral(">\r\n");
|
||||
|
||||
|
||||
#line 83 "..\..\Views\Device\AddOffline.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 83 "..\..\Views\Device\AddOffline.cshtml"
|
||||
if (!hasDeviceProfile)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 85 "..\..\Views\Device\AddOffline.cshtml"
|
||||
Write(Html.Hidden("Device.DeviceProfileId", Model.DefaultDeviceProfileId));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 85 "..\..\Views\Device\AddOffline.cshtml"
|
||||
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n <input");
|
||||
|
||||
WriteLiteral(" type=\"submit\"");
|
||||
|
||||
@@ -228,35 +367,123 @@ WriteLiteral(" class=\"button\"");
|
||||
|
||||
WriteLiteral(" value=\"Add\"");
|
||||
|
||||
WriteLiteral(" />\r\n </p>\r\n <script");
|
||||
WriteLiteral(" />\r\n </p>\r\n <script");
|
||||
|
||||
WriteLiteral(" type=\"text/javascript\"");
|
||||
|
||||
WriteLiteral(@">
|
||||
$(function () {
|
||||
$SerialNumber = $('#Device_SerialNumber');
|
||||
$AssetNumber = $('#Device_AssetNumber');
|
||||
$Location = $('#Device_Location');
|
||||
$AssignedUserId = $('#Device_AssignedUserId');
|
||||
WriteLiteral(">\r\n $(function () {\r\n var $SerialNumber = $(\'#D" +
|
||||
"evice_SerialNumber\').focus();\r\n\r\n");
|
||||
|
||||
$SerialNumber.focus().keydown(function (e) {
|
||||
|
||||
#line 94 "..\..\Views\Device\AddOffline.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 94 "..\..\Views\Device\AddOffline.cshtml"
|
||||
if (hasAssignUser)
|
||||
{
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n $SerialNumber.keydown(function (e) {\r\n if (e" +
|
||||
".which == 13) {\r\n $(\'#Device_AssignedUserId\').focus();\r\n " +
|
||||
" return false;\r\n }\r\n });" +
|
||||
"");
|
||||
|
||||
|
||||
#line 101 "..\..\Views\Device\AddOffline.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 102 "..\..\Views\Device\AddOffline.cshtml"
|
||||
if (hasAssetNumber)
|
||||
{
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n $(\'#Device_AssetNumber\').keydown(function (e) {\r\n " +
|
||||
" if (e.which == 13) {\r\n");
|
||||
|
||||
|
||||
#line 106 "..\..\Views\Device\AddOffline.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 106 "..\..\Views\Device\AddOffline.cshtml"
|
||||
if (hasLocation)
|
||||
{
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("$(\'#Device_Location\').focus(); return false;");
|
||||
|
||||
|
||||
#line 107 "..\..\Views\Device\AddOffline.cshtml"
|
||||
}
|
||||
else if (hasAssignUser)
|
||||
{
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("$(\'#Device_AssignedUserId\').focus(); return false;");
|
||||
|
||||
|
||||
#line 109 "..\..\Views\Device\AddOffline.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" }\r\n });\r\n ");
|
||||
|
||||
|
||||
#line 112 "..\..\Views\Device\AddOffline.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 113 "..\..\Views\Device\AddOffline.cshtml"
|
||||
if (hasLocation && hasAssignUser)
|
||||
{
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"
|
||||
$('#Device_Location').keydown(function (e) {
|
||||
if (e.which == 13) {
|
||||
$AssignedUserId.focus();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
$AssetNumber.keydown(function (e) {
|
||||
if (e.which == 13) {
|
||||
$Location.focus();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
$Location.keydown(function (e) {
|
||||
if (e.which == 13) {
|
||||
$AssignedUserId.focus();
|
||||
$('#Device_AssignedUserId').focus();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
");
|
||||
|
||||
|
||||
#line 121 "..\..\Views\Device\AddOffline.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 122 "..\..\Views\Device\AddOffline.cshtml"
|
||||
if (hasAssignUser)
|
||||
{
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"
|
||||
var $AssignedUserId = $('#Device_AssignedUserId');
|
||||
$AssignedUserId
|
||||
.watermark('Search Users')
|
||||
.focus(function () { $AssignedUserId.select() })
|
||||
@@ -264,7 +491,7 @@ WriteLiteral(@">
|
||||
source: '");
|
||||
|
||||
|
||||
#line 95 "..\..\Views\Device\AddOffline.cshtml"
|
||||
#line 129 "..\..\Views\Device\AddOffline.cshtml"
|
||||
Write(Url.Action(MVC.API.User.UpstreamUsers()));
|
||||
|
||||
|
||||
@@ -286,13 +513,19 @@ WriteLiteral(@"',
|
||||
.append(""<a><strong>"" + item.DisplayName + ""</strong><br>"" + item.Id + "" ("" + item.Type + "")</a>"")
|
||||
.appendTo(ul);
|
||||
};
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
");
|
||||
");
|
||||
|
||||
|
||||
#line 114 "..\..\Views\Device\AddOffline.cshtml"
|
||||
#line 145 "..\..\Views\Device\AddOffline.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" });\r\n </script>\r\n </div>\r\n");
|
||||
|
||||
|
||||
#line 149 "..\..\Views\Device\AddOffline.cshtml"
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user