09c2a24222
Refactor to target specific Domain Controllers, with failover.
498 lines
18 KiB
C#
498 lines
18 KiB
C#
#pragma warning disable 1591
|
|
//------------------------------------------------------------------------------
|
|
// <auto-generated>
|
|
// This code was generated by a tool.
|
|
// Runtime Version:4.0.30319.34014
|
|
//
|
|
// Changes to this file may cause incorrect behavior and will be lost if
|
|
// the code is regenerated.
|
|
// </auto-generated>
|
|
//------------------------------------------------------------------------------
|
|
|
|
namespace Disco.Web.Areas.Config.Views.AuthorizationRole
|
|
{
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Net;
|
|
using System.Text;
|
|
using System.Web;
|
|
using System.Web.Helpers;
|
|
using System.Web.Mvc;
|
|
using System.Web.Mvc.Ajax;
|
|
using System.Web.Mvc.Html;
|
|
using System.Web.Routing;
|
|
using System.Web.Security;
|
|
using System.Web.UI;
|
|
using System.Web.WebPages;
|
|
using Disco;
|
|
using Disco.BI.Extensions;
|
|
using Disco.Models.Repository;
|
|
using Disco.Services;
|
|
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("~/Areas/Config/Views/AuthorizationRole/Index.cshtml")]
|
|
public partial class Index : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.AuthorizationRole.IndexModel>
|
|
{
|
|
public Index()
|
|
{
|
|
}
|
|
public override void Execute()
|
|
{
|
|
|
|
#line 2 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
|
|
|
Authorization.Require(Claims.DiscoAdminAccount);
|
|
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Authorization Roles");
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\r\n");
|
|
|
|
|
|
#line 6 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
|
if (Model.Tokens.Count == 0)
|
|
{
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" <div");
|
|
|
|
WriteLiteral(" class=\"form\"");
|
|
|
|
WriteLiteral(" style=\"width: 450px; padding: 100px 0;\"");
|
|
|
|
WriteLiteral(">\r\n <h2>No authorization roles are configured</h2>\r\n </div> \r\n");
|
|
|
|
|
|
#line 11 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
|
}
|
|
else
|
|
{
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" <table");
|
|
|
|
WriteLiteral(" class=\"tableData\"");
|
|
|
|
WriteLiteral(">\r\n <tr>\r\n <th>Name\r\n </th>\r\n <th>Linked " +
|
|
"Groups/Users\r\n </th>\r\n </tr>\r\n");
|
|
|
|
|
|
#line 21 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 21 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
|
foreach (var item in Model.Tokens)
|
|
{
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" <tr>\r\n <td>\r\n");
|
|
|
|
WriteLiteral(" ");
|
|
|
|
|
|
#line 25 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
|
Write(Html.ActionLink(item.Role.Name, MVC.Config.AuthorizationRole.Index(item.Role.Id)));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\r\n </td>\r\n <td>\r\n");
|
|
|
|
|
|
#line 28 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 28 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
|
if (item.SubjectIds.Count == 0)
|
|
{
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" <span");
|
|
|
|
WriteLiteral(" class=\"smallMessage\"");
|
|
|
|
WriteLiteral("><None></span>\r\n");
|
|
|
|
|
|
#line 31 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
|
}
|
|
else
|
|
{
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 34 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
|
Write(string.Join(", ", item.SubjectIds.OrderBy(i => i)));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 34 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
|
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" </td>\r\n </tr>\r\n");
|
|
|
|
|
|
#line 38 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" </table>\r\n");
|
|
|
|
|
|
#line 40 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("<!-- #region Administrator Subjects -->\r\n<div");
|
|
|
|
WriteLiteral(" id=\"Config_AuthRoles_Subjects_Update_Dialog\"");
|
|
|
|
WriteLiteral(" class=\"dialog\"");
|
|
|
|
WriteLiteral(" title=\"Disco Administrators\"");
|
|
|
|
WriteLiteral(">\r\n <div");
|
|
|
|
WriteLiteral(" id=\"Config_AuthRoles_Subjects_Update_Dialog_ListContainer\"");
|
|
|
|
WriteLiteral(">\r\n <span");
|
|
|
|
WriteLiteral(" id=\"Config_AuthRoles_Subjects_Update_Dialog_None\"");
|
|
|
|
WriteLiteral(" class=\"smallMessage\"");
|
|
|
|
WriteLiteral(">None Associated</span>\r\n <ul");
|
|
|
|
WriteLiteral(" id=\"Config_AuthRoles_Subjects_Update_Dialog_List\"");
|
|
|
|
WriteLiteral(" class=\"none\"");
|
|
|
|
WriteLiteral(">\r\n");
|
|
|
|
|
|
#line 46 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 46 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
|
foreach (var sg in Model.AdministratorSubjects)
|
|
{
|
|
var displayName = sg.Id == sg.Name ? sg.Id : string.Format("{0} [{1}]", sg.Name, sg.Id);
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" <li");
|
|
|
|
WriteAttribute("class", Tuple.Create(" class=\"", 1805), Tuple.Create("\"", 1845)
|
|
|
|
#line 49 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
|
, Tuple.Create(Tuple.Create("", 1813), Tuple.Create<System.Object, System.Int32>(sg.IsGroup ? "group" : "user"
|
|
|
|
#line default
|
|
#line hidden
|
|
, 1813), false)
|
|
);
|
|
|
|
WriteLiteral(" data-subjectid=\"");
|
|
|
|
|
|
#line 49 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
|
Write(sg.Id);
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\"");
|
|
|
|
WriteLiteral(">");
|
|
|
|
|
|
#line 49 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
|
if (sg.IsGroup)
|
|
{
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" <i");
|
|
|
|
WriteLiteral(" class=\"fa fa-users fa-lg\"");
|
|
|
|
WriteLiteral("></i>");
|
|
|
|
|
|
#line 51 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 51 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
|
Write(displayName);
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 51 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
|
|
|
}
|
|
else
|
|
{
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" <i");
|
|
|
|
WriteLiteral(" class=\"fa fa-user fa-lg\"");
|
|
|
|
WriteLiteral("></i>");
|
|
|
|
|
|
#line 55 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 55 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
|
Write(displayName);
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 55 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
|
|
|
}
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("<i");
|
|
|
|
WriteLiteral(" class=\"fa fa-times-circle remove\"");
|
|
|
|
WriteLiteral("></i></li>\r\n");
|
|
|
|
|
|
#line 57 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" </ul>\r\n </div>\r\n <div");
|
|
|
|
WriteLiteral(" id=\"Config_AuthRoles_Subjects_Update_Dialog_AddContainer\"");
|
|
|
|
WriteLiteral(">\r\n <input");
|
|
|
|
WriteLiteral(" type=\"text\"");
|
|
|
|
WriteLiteral(" id=\"Config_AuthRoles_Subjects_Update_Dialog_TextAdd\"");
|
|
|
|
WriteLiteral(" />\r\n <a");
|
|
|
|
WriteLiteral(" id=\"Config_AuthRoles_Subjects_Update_Dialog_Add\"");
|
|
|
|
WriteLiteral(" href=\"#\"");
|
|
|
|
WriteLiteral(" class=\"button small\"");
|
|
|
|
WriteLiteral(">Add</a>\r\n </div>\r\n <form");
|
|
|
|
WriteLiteral(" id=\"Config_AuthRoles_Subjects_Update_Dialog_Form\"");
|
|
|
|
WriteAttribute("action", Tuple.Create(" action=\"", 2876), Tuple.Create("\"", 2965)
|
|
|
|
#line 64 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
|
, Tuple.Create(Tuple.Create("", 2885), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.AuthorizationRole.UpdateAdministratorSubjects(null, true))
|
|
|
|
#line default
|
|
#line hidden
|
|
, 2885), false)
|
|
);
|
|
|
|
WriteLiteral(" method=\"post\"");
|
|
|
|
WriteLiteral(@"></form>
|
|
</div>
|
|
<script>
|
|
(function () {
|
|
var dialog, textAdd, list, noSubjects, form;
|
|
|
|
function showDialog() {
|
|
if (!dialog) {
|
|
dialog = $('#Config_AuthRoles_Subjects_Update_Dialog').dialog({
|
|
resizable: false,
|
|
modal: true,
|
|
autoOpen: false,
|
|
width: 350,
|
|
height: 420,
|
|
buttons: {
|
|
""Save Changes"": saveChanges,
|
|
Cancel: cancel
|
|
}
|
|
});
|
|
|
|
dialog.on('click', '.remove', remove);
|
|
|
|
list = $('#Config_AuthRoles_Subjects_Update_Dialog_List');
|
|
noSubjects = $('#Config_AuthRoles_Subjects_Update_Dialog_None');
|
|
|
|
textAdd = $('#Config_AuthRoles_Subjects_Update_Dialog_TextAdd');
|
|
|
|
textAdd.watermark('Search Subjects')
|
|
.autocomplete({
|
|
source: '");
|
|
|
|
|
|
#line 93 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
|
Write(Url.Action(MVC.API.System.SearchSubjects()));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\',\r\n minLength: 2,\r\n focus: functio" +
|
|
"n (e, ui) {\r\n textAdd.val(ui.item.Id);\r\n " +
|
|
" return false;\r\n },\r\n " +
|
|
" select: function (e, ui) {\r\n textAdd.val(ui.item.Id" +
|
|
").blur();\r\n return false;\r\n }\r" +
|
|
"\n }).data(\'ui-autocomplete\')._renderItem = function (ul, item" +
|
|
") {\r\n return $(\"<li></li>\")\r\n " +
|
|
".data(\"item.autocomplete\", item)\r\n .append(\"<a><stron" +
|
|
"g>\" + item.Name + \"</strong><br>\" + item.Id + \" (\" + item.Type + \")</a>\")\r\n " +
|
|
" .appendTo(ul);\r\n };\r\n\r\n " +
|
|
" $(\'#Config_AuthRoles_Subjects_Update_Dialog_Add\').click(add);\r\n }\r\n\r" +
|
|
"\n dialog.dialog(\'open\');\r\n\r\n updateNoSubjects();\r\n " +
|
|
" return false;\r\n }\r\n\r\n function cancel() {\r\n $(this)" +
|
|
".dialog(\"close\");\r\n\r\n list.find(\'li\').each(function () {\r\n " +
|
|
" $this = $(this);\r\n if ($this.is(\'[data-subjectstatus=\"new\"]\'" +
|
|
")) {\r\n $this.remove();\r\n } else {\r\n " +
|
|
" if ($this.is(\'[data-subjectstatus=\"removed\"]\')) {\r\n " +
|
|
" $this.show();\r\n }\r\n }\r\n });\r\n " +
|
|
" }\r\n\r\n function remove() {\r\n $this = $(this).closest(\'li\'" +
|
|
");\r\n\r\n if ($this.is(\'[data-subjectstatus=\"new\"]\')) {\r\n " +
|
|
" $this.remove();\r\n } else {\r\n $this.attr(\'data-subject" +
|
|
"status\', \'removed\').hide();\r\n }\r\n\r\n updateNoSubjects();\r\n " +
|
|
" return false;\r\n }\r\n\r\n function add() {\r\n var" +
|
|
" id = textAdd.val();\r\n\r\n $.ajax({\r\n url: \'");
|
|
|
|
|
|
#line 151 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
|
Write(Url.Action(MVC.API.System.Subject()));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\',\r\n method: \'post\',\r\n data: { Id: id }\r\n " +
|
|
" }).done(function (response) {\r\n if (response) {\r\n " +
|
|
" if (response.IsGroup || response.IsUserAccount) {\r\n " +
|
|
" if (list.find(\'li[data-subjectid=\"\' + response.Id.replace(\'\\\\\', \'\\\\\\\\\') + \'\"]\')" +
|
|
".length == 0) {\r\n\r\n var liIcon = $(\'<i>\').addClass(\'f" +
|
|
"a fa-lg\');\r\n if (response.Type === \'user\')\r\n " +
|
|
" liIcon.addClass(\'fa-user\');\r\n " +
|
|
"else\r\n liIcon.addClass(\'fa-users\');\r\n\r\n " +
|
|
" var li = $(\'<li>\')\r\n .append(li" +
|
|
"Icon)\r\n .append($(\'<span>\').text(response.Id == r" +
|
|
"esponse.Name ? response.Id : response.Name + \' [\' + response.Id + \']\'))\r\n " +
|
|
" .append($(\'<i>\').addClass(\'fa fa-times-circle remove\'))" +
|
|
"\r\n .addClass(response.Type)\r\n " +
|
|
" .attr(\'data-subjectid\', response.Id)\r\n " +
|
|
" .attr(\'data-subjectstatus\', \'new\');\r\n\r\n list.append" +
|
|
"(li);\r\n\r\n updateNoSubjects();\r\n " +
|
|
" } else {\r\n alert(\'That subject has already been add" +
|
|
"ed\');\r\n }\r\n }\r\n els" +
|
|
"e {\r\n alert(response.Name + \' [\'+response.Id+\'] is a \' + " +
|
|
"response.Type + \'. Only users and groups can be added.\');\r\n }" +
|
|
"\r\n } else {\r\n alert(\'Unknown Id\');\r\n " +
|
|
" }\r\n }).fail(function (jqXHR, textStatus, errorThrown) {\r\n " +
|
|
" alert(\'Error: \' + errorThrown);\r\n });\r\n retu" +
|
|
"rn false;\r\n }\r\n\r\n function updateNoSubjects() {\r\n i" +
|
|
"f (list.find(\'li:visible\').length > 0)\r\n noSubjects.hide();\r\n " +
|
|
" else\r\n noSubjects.show();\r\n }\r\n\r\n function " +
|
|
"saveChanges() {\r\n var form = $(\'#Config_AuthRoles_Subjects_Update_Dia" +
|
|
"log_Form\').empty();\r\n\r\n list.find(\'li[data-subjectstatus!=\"removed\"]\'" +
|
|
").each(function () {\r\n var subjectId = $(this).attr(\'data-subject" +
|
|
"id\');\r\n\r\n form.append($(\'<input>\').attr({\r\n \'n" +
|
|
"ame\': \'Subjects\',\r\n \'type\': \'hidden\'\r\n }).val(" +
|
|
"subjectId));\r\n\r\n }).get();\r\n\r\n form.submit();\r\n\r\n " +
|
|
" dialog.dialog(\"disable\");\r\n dialog.dialog(\"option\", \"buttons\", nul" +
|
|
"l);\r\n }\r\n\r\n $(function () {\r\n $(\'#Config_AuthRoles_Upda" +
|
|
"teAdministrators\').click(showDialog);\r\n });\r\n\r\n })();\r\n</script>\r\n<!--" +
|
|
" #endregion -->\r\n<div");
|
|
|
|
WriteLiteral(" class=\"actionBar\"");
|
|
|
|
WriteLiteral(">\r\n <a");
|
|
|
|
WriteLiteral(" id=\"Config_AuthRoles_UpdateAdministrators\"");
|
|
|
|
WriteLiteral(" href=\"#\"");
|
|
|
|
WriteLiteral(" class=\"button\"");
|
|
|
|
WriteLiteral(">Update Disco Administrators [");
|
|
|
|
|
|
#line 226 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
|
Write(Model.AdministratorSubjects.Count);
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("]</a>\r\n");
|
|
|
|
WriteLiteral(" ");
|
|
|
|
|
|
#line 227 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
|
Write(Html.ActionLinkButton("Create Authorization Role", MVC.Config.AuthorizationRole.Create()));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\r\n</div>\r\n");
|
|
|
|
}
|
|
}
|
|
}
|
|
#pragma warning restore 1591
|