be7ee4cae8
feature: flag permissions
833 lines
33 KiB
C#
833 lines
33 KiB
C#
#pragma warning disable 1591
|
|
//------------------------------------------------------------------------------
|
|
// <auto-generated>
|
|
// This code was generated by a tool.
|
|
// Runtime Version:4.0.30319.42000
|
|
//
|
|
// 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.Models.Repository;
|
|
|
|
#line 2 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
using Disco.Models.Services.Authorization;
|
|
|
|
#line default
|
|
#line hidden
|
|
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/Show.cshtml")]
|
|
public partial class Show : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.AuthorizationRole.ShowModel>
|
|
{
|
|
public Show()
|
|
{
|
|
}
|
|
public override void Execute()
|
|
{
|
|
|
|
#line 3 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
|
|
Authorization.Require(Claims.DiscoAdminAccount);
|
|
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Authorization Roles", MVC.Config.AuthorizationRole.Index(null), Model.Token.Role.Name);
|
|
Html.BundleDeferred("~/ClientScripts/Modules/Disco-PropertyChangeHelpers");
|
|
Html.BundleDeferred("~/ClientScripts/Modules/Disco-AjaxHelperIcons");
|
|
Html.BundleDeferred("~/Style/Fancytree");
|
|
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-Fancytree");
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\r\n<div");
|
|
|
|
WriteLiteral(" id=\"Config_AuthRoles_Show\"");
|
|
|
|
WriteLiteral(" class=\"form\"");
|
|
|
|
WriteLiteral(" style=\"width: 550px\"");
|
|
|
|
WriteLiteral(">\r\n <table>\r\n <tr>\r\n <th");
|
|
|
|
WriteLiteral(" style=\"width: 150px\"");
|
|
|
|
WriteLiteral(">\r\n Id:\r\n </th>\r\n <td>\r\n");
|
|
|
|
WriteLiteral(" ");
|
|
|
|
|
|
#line 18 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
Write(Html.DisplayFor(model => model.Token.Role.Id));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th>\r\n " +
|
|
" Name:\r\n </th>\r\n <td>\r\n");
|
|
|
|
WriteLiteral(" ");
|
|
|
|
|
|
#line 26 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
Write(Html.EditorFor(model => model.Token.Role.Name));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\r\n");
|
|
|
|
WriteLiteral(" ");
|
|
|
|
|
|
#line 27 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
Write(AjaxHelpers.AjaxSave());
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\r\n");
|
|
|
|
WriteLiteral(" ");
|
|
|
|
|
|
#line 28 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
Write(AjaxHelpers.AjaxLoader());
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\r\n <script");
|
|
|
|
WriteLiteral(" type=\"text/javascript\"");
|
|
|
|
WriteLiteral(">\r\n $(function () {\r\n document.DiscoFun" +
|
|
"ctions.PropertyChangeHelper(\r\n $(\'#Token_Role_Name\')," +
|
|
"\r\n \'Invalid Name\',\r\n \'");
|
|
|
|
|
|
#line 34 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
Write(Url.Action(MVC.API.AuthorizationRole.UpdateName(Model.Token.Role.Id)));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\',\r\n \'RoleName\'\r\n );\r\n " +
|
|
" });\r\n </script>\r\n </td>\r\n </tr>\r\n " +
|
|
" <tr>\r\n <th>Linked Groups/Users:</th>\r\n <td>\r\n");
|
|
|
|
|
|
#line 44 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 44 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
if (Model.Token.SubjectIds.Count == 0)
|
|
{
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" <span");
|
|
|
|
WriteLiteral(" class=\"smallMessage\"");
|
|
|
|
WriteLiteral(">None Associated</span>\r\n");
|
|
|
|
|
|
#line 47 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
}
|
|
else
|
|
{
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" <ul");
|
|
|
|
WriteLiteral(" id=\"Config_AuthRoles_Subjects\"");
|
|
|
|
WriteLiteral(" class=\"none\"");
|
|
|
|
WriteLiteral(">\r\n");
|
|
|
|
|
|
#line 51 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 51 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
foreach (var sg in Model.Subjects)
|
|
{
|
|
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=\"", 2250), Tuple.Create("\"", 2290)
|
|
|
|
#line 54 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
, Tuple.Create(Tuple.Create("", 2258), Tuple.Create<System.Object, System.Int32>(sg.IsGroup ? "group" : "user"
|
|
|
|
#line default
|
|
#line hidden
|
|
, 2258), false)
|
|
);
|
|
|
|
WriteLiteral(">\r\n");
|
|
|
|
|
|
#line 55 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 55 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
if (sg.IsGroup)
|
|
{
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" <i");
|
|
|
|
WriteLiteral(" class=\"fa fa-users fa-lg\"");
|
|
|
|
WriteLiteral("></i>");
|
|
|
|
|
|
#line 57 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 57 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
Write(displayName);
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 57 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
|
|
}
|
|
else
|
|
{
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" <a");
|
|
|
|
WriteAttribute("href", Tuple.Create(" href=\"", 2608), Tuple.Create("\"", 2678)
|
|
|
|
#line 61 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
, Tuple.Create(Tuple.Create("", 2615), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.User.Show(sg.Id))
|
|
|
|
#line default
|
|
#line hidden
|
|
, 2615), false)
|
|
, Tuple.Create(Tuple.Create("", 2650), Tuple.Create("#UserDetailTab-Authorization", 2650), true)
|
|
);
|
|
|
|
WriteLiteral("><i");
|
|
|
|
WriteLiteral(" class=\"fa fa-user fa-lg\"");
|
|
|
|
WriteLiteral("></i>");
|
|
|
|
|
|
#line 61 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
Write(displayName);
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("</a>\r\n");
|
|
|
|
|
|
#line 62 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" </li>\r\n");
|
|
|
|
|
|
#line 64 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" </ul>\r\n");
|
|
|
|
|
|
#line 66 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" <div>\r\n <a");
|
|
|
|
WriteLiteral(" id=\"Config_AuthRoles_Subjects_Update\"");
|
|
|
|
WriteLiteral(" href=\"#\"");
|
|
|
|
WriteLiteral(" class=\"button small\"");
|
|
|
|
WriteLiteral(">Update</a>\r\n <div");
|
|
|
|
WriteLiteral(" id=\"Config_AuthRoles_Subjects_Update_Dialog\"");
|
|
|
|
WriteLiteral(" class=\"dialog\"");
|
|
|
|
WriteLiteral(" title=\"Authorization Role Linked Groups/Users\"");
|
|
|
|
WriteLiteral(" data-searchsubjectsurl=\"");
|
|
|
|
|
|
#line 69 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
Write(Url.Action(MVC.API.System.SearchSubjects()));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\"");
|
|
|
|
WriteLiteral(" data-subjecturl=\"");
|
|
|
|
|
|
#line 69 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
Write(Url.Action(MVC.API.System.Subject()));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\"");
|
|
|
|
WriteLiteral(">\r\n");
|
|
|
|
|
|
#line 70 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 70 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
using (Html.BeginForm(MVC.API.AuthorizationRole.UpdateSubjects(Model.Token.Role.Id, null, true)))
|
|
{
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 72 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
Write(Html.AntiForgeryToken());
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 72 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" <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 76 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 76 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
foreach (var sg in Model.Subjects)
|
|
{
|
|
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=\"", 4079), Tuple.Create("\"", 4119)
|
|
|
|
#line 79 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
, Tuple.Create(Tuple.Create("", 4087), Tuple.Create<System.Object, System.Int32>(sg.IsGroup ? "group" : "user"
|
|
|
|
#line default
|
|
#line hidden
|
|
, 4087), false)
|
|
);
|
|
|
|
WriteLiteral(" data-subjectid=\"");
|
|
|
|
|
|
#line 79 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
Write(sg.Id);
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\"");
|
|
|
|
WriteLiteral(">\r\n <input");
|
|
|
|
WriteLiteral(" type=\"hidden\"");
|
|
|
|
WriteLiteral(" name=\"subjects\"");
|
|
|
|
WriteAttribute("value", Tuple.Create(" value=\"", 4227), Tuple.Create("\"", 4241)
|
|
|
|
#line 80 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
, Tuple.Create(Tuple.Create("", 4235), Tuple.Create<System.Object, System.Int32>(sg.Id
|
|
|
|
#line default
|
|
#line hidden
|
|
, 4235), false)
|
|
);
|
|
|
|
WriteLiteral(" />\r\n");
|
|
|
|
|
|
#line 81 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 81 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
if (sg.IsGroup)
|
|
{
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" <i");
|
|
|
|
WriteLiteral(" class=\"fa fa-users fa-lg\"");
|
|
|
|
WriteLiteral("></i>");
|
|
|
|
|
|
#line 83 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 83 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
Write(displayName);
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 83 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
|
|
}
|
|
else
|
|
{
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" <i");
|
|
|
|
WriteLiteral(" class=\"fa fa-user fa-lg\"");
|
|
|
|
WriteLiteral("></i>");
|
|
|
|
|
|
#line 87 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 87 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
Write(displayName);
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 87 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
|
|
}
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("<i");
|
|
|
|
WriteLiteral(" class=\"fa fa-times-circle remove\"");
|
|
|
|
WriteLiteral("></i>\r\n </li>\r\n");
|
|
|
|
|
|
#line 90 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" </ul>\r\n </div>\r\n");
|
|
|
|
|
|
#line 93 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" <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 <button");
|
|
|
|
WriteLiteral(" id=\"Config_AuthRoles_Subjects_Update_Dialog_Add\"");
|
|
|
|
WriteLiteral(" type=\"button\"");
|
|
|
|
WriteLiteral(" class=\"button small\"");
|
|
|
|
WriteLiteral(">Add</button>\r\n </div>\r\n </div>\r\n " +
|
|
" <script>\r\n (function () {\r\n " +
|
|
" let dialog, textAdd, list, originalList, noSubjects;\r\n\r\n " +
|
|
" function showDialog() {\r\n if (!di" +
|
|
"alog) {\r\n list = $(\'#Config_AuthRoles_Subject" +
|
|
"s_Update_Dialog_List\');\r\n originalList = list" +
|
|
".html();\r\n noSubjects = $(\'#Config_AuthRoles_" +
|
|
"Subjects_Update_Dialog_None\');\r\n textAdd = $(" +
|
|
"\'#Config_AuthRoles_Subjects_Update_Dialog_TextAdd\');\r\n\r\n " +
|
|
" dialog = $(\'#Config_AuthRoles_Subjects_Update_Dialog\').dialog({\r\n " +
|
|
" resizable: false,\r\n " +
|
|
" modal: true,\r\n autoOpen: " +
|
|
"false,\r\n width: 350,\r\n " +
|
|
" buttons: {\r\n \"Sa" +
|
|
"ve Changes\": saveChanges,\r\n Cancel: f" +
|
|
"unction () {\r\n $(this).dialog(\"cl" +
|
|
"ose\");\r\n }\r\n " +
|
|
" },\r\n close: function () {\r" +
|
|
"\n list.html(originalList);\r\n " +
|
|
" }\r\n });\r\n\r\n " +
|
|
" dialog.on(\'click\', \'.remove\', function () {\r\n " +
|
|
" $(this).closest(\'li\').remove();\r\n " +
|
|
" updateNoSubjects();\r\n " +
|
|
" });\r\n\r\n\r\n textAdd.watermark(\'Search S" +
|
|
"ubjects\')\r\n .autocomplete({\r\n " +
|
|
" source: dialog.attr(\'data-searchsubjectsurl\'),\r\n" +
|
|
" minLength: 2,\r\n " +
|
|
" focus: function (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 " +
|
|
" $(\'#Config_AuthRoles_Subjects_Update_Dialog_" +
|
|
"Add\').trigger(\'click\');\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><strong>\" + item.Name + \"</stron" +
|
|
"g><br>\" + item.Id + \" (\" + item.Type + \")</a>\")\r\n " +
|
|
" .appendTo(ul);\r\n };\r\n\r\n " +
|
|
" $(\'#Config_AuthRoles_Subjects_Update_Dialog_A" +
|
|
"dd\').on(\'click\', add);\r\n }\r\n\r\n " +
|
|
" dialog.dialog(\'open\');\r\n\r\n updateNoS" +
|
|
"ubjects();\r\n return false;\r\n " +
|
|
" }\r\n\r\n async function add() {\r\n " +
|
|
" const id = textAdd.val();\r\n\r\n try" +
|
|
" {\r\n const body = new FormData();\r\n " +
|
|
" body.append(\'__RequestVerificationToken\', document.bod" +
|
|
"y.dataset.antiforgery);\r\n body.append(\'id\', i" +
|
|
"d);\r\n const response = await fetch(dialog.att" +
|
|
"r(\'data-subjecturl\'), {\r\n method: \'POST\'," +
|
|
"\r\n body: body\r\n " +
|
|
" });\r\n\r\n if (response.ok) {\r\n " +
|
|
" const data = await response.json();\r\n\r\n " +
|
|
" if (!data)\r\n " +
|
|
" throw \'Unknown user id\';\r\n\r\n if (" +
|
|
"!data.IsGroup && !data.IsUserAccount)\r\n " +
|
|
" throw data.Name + \' [\' + data.Id + \'] is a \' + data.Type + \'. Only users and " +
|
|
"groups can be added.\';\r\n\r\n if (list.find(" +
|
|
"\'li[data-subjectid=\"\' + data.Id.replace(\'\\\\\', \'\\\\\\\\\') + \'\"]\').length != 0) {\r\n " +
|
|
" throw \'That subject has already been a" +
|
|
"dded\';\r\n }\r\n\r\n " +
|
|
" const liIcon = $(\'<i>\').addClass(\'fa fa-lg\');\r\n " +
|
|
" if (data.Type === \'user\')\r\n " +
|
|
" liIcon.addClass(\'fa-user\');\r\n " +
|
|
"else\r\n liIcon.addClass(\'fa-users\');\r\n" +
|
|
"\r\n const li = $(\'<li>\')\r\n " +
|
|
" .append($(\'<input>\').attr({ type: \'hidden\', name: \'s" +
|
|
"ubjects\', value: data.Id }))\r\n .appen" +
|
|
"d(liIcon)\r\n .append($(\'<span>\').text(" +
|
|
"data.Id == data.Name ? data.Id : data.Name + \' [\' + data.Id + \']\'))\r\n " +
|
|
" .append($(\'<i>\').addClass(\'fa fa-times-circle r" +
|
|
"emove\'))\r\n .addClass(data.Type)\r\n " +
|
|
" .attr(\'data-subjectid\', data.Id)\r\n " +
|
|
" .attr(\'data-subjectstatus\', \'new\');\r\n\r\n " +
|
|
" list.append(li);\r\n " +
|
|
" textAdd.val(\'\');\r\n\r\n updat" +
|
|
"eNoSubjects();\r\n } else {\r\n " +
|
|
" alert(\'Error: \' + response.statusText);\r\n " +
|
|
" }\r\n\r\n } catch (e) {\r\n " +
|
|
" alert(\'Error: \' + e);\r\n " +
|
|
" }\r\n\r\n return false;\r\n " +
|
|
" }\r\n\r\n function updateNoSubjects() {\r\n " +
|
|
" if (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 " +
|
|
" dialog\r\n .dialog(\"option\", \"buttons\"," +
|
|
" null)\r\n .find(\'form\').trigger(\'submit\');\r\n " +
|
|
" }\r\n\r\n $(\'#Config_AuthRoles_" +
|
|
"Subjects_Update\').click(showDialog);\r\n })();\r\n " +
|
|
" </script>\r\n </div>\r\n </td>\r\n </tr>\r\n " +
|
|
" <tr>\r\n <td");
|
|
|
|
WriteLiteral(" colspan=\"2\"");
|
|
|
|
WriteLiteral(">\r\n <div");
|
|
|
|
WriteLiteral(" id=\"Config_AuthRoles_Claims_Tree\"");
|
|
|
|
WriteLiteral(">\r\n </div>\r\n <div>\r\n <button");
|
|
|
|
WriteLiteral(" type=\"button\"");
|
|
|
|
WriteLiteral(" typeof=\"button\"");
|
|
|
|
WriteLiteral(" id=\"Config_AuthRoles_Claims_SaveChanges\"");
|
|
|
|
WriteLiteral(" class=\"button small disabled\"");
|
|
|
|
WriteLiteral(" data-saveurl=\"");
|
|
|
|
|
|
#line 240 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
Write(Url.Action(MVC.API.AuthorizationRole.UpdateClaims(Model.Token.Role.Id)));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\"");
|
|
|
|
WriteLiteral(">Save Changes</button>");
|
|
|
|
|
|
#line 240 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
Write(AjaxHelpers.AjaxLoader());
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\r\n </div>\r\n <script");
|
|
|
|
WriteLiteral(" id=\"Config_AuthRoles_Claims_NodesJson\"");
|
|
|
|
WriteLiteral(" type=\"application/json\"");
|
|
|
|
WriteLiteral(">\r\n");
|
|
|
|
WriteLiteral(" ");
|
|
|
|
|
|
#line 243 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
Write(Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(Model.ClaimNavigatorFancyTreeNodes)));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\r\n </script>\r\n <script>\r\n (funct" +
|
|
"ion () {\r\n var claimNodes = JSON.parse($(\'#Config_AuthRol" +
|
|
"es_Claims_NodesJson\').html());\r\n\r\n $(function () {\r\n " +
|
|
" var saveButton = $(\'#Config_AuthRoles_Claims_SaveChanges\'" +
|
|
");\r\n var ajaxLoading = saveButton.next(\'.ajaxLoading\'" +
|
|
");\r\n\r\n var tree = $(\'#Config_AuthRoles_Claims_Tree\')." +
|
|
"fancytree({\r\n source: claimNodes,\r\n " +
|
|
" checkbox: true,\r\n selectMode: 3" +
|
|
",\r\n select: function () {\r\n " +
|
|
" saveButton.removeClass(\'disabled\');\r\n " +
|
|
" },\r\n keyboard: false\r\n " +
|
|
" });\r\n\r\n saveButton.on(\'click\', async function () " +
|
|
"{\r\n if (!saveButton.is(\'.disabled\')) {\r\n " +
|
|
" ajaxLoading.show();\r\n\r\n " +
|
|
" try {\r\n const body = new FormData()" +
|
|
";\r\n body.append(\'__RequestVerificationTok" +
|
|
"en\', document.body.dataset.antiforgery);\r\n\r\n " +
|
|
" var selectedNodes = tree.fancytree(\'getTree\').getSelectedNodes();\r\n\r\n " +
|
|
" var selectedKeys = [];\r\n " +
|
|
" for (var i = 0; i < selectedNodes.length; i++) {\r\n " +
|
|
" var node = selectedNodes[i];\r\n " +
|
|
" if (!node.folder)\r\n " +
|
|
" body.append(\'claimKeys\', node.key);\r\n " +
|
|
" }\r\n\r\n const response = await fet" +
|
|
"ch(saveButton.attr(\'data-saveurl\'), {\r\n " +
|
|
" method: \'POST\',\r\n body: body\r\n " +
|
|
" });\r\n\r\n " +
|
|
" if (response.ok) {\r\n saveButton.ad" +
|
|
"dClass(\'disabled\');\r\n ajaxLoading.nex" +
|
|
"t(\'.ajaxOk\').show().delay(\'fast\').fadeOut(\'slow\');\r\n " +
|
|
" } else {\r\n alert(\'Unable " +
|
|
"to save changes:\\n\' + response.statusText);\r\n " +
|
|
" }\r\n } catch (e) {\r\n " +
|
|
" alert(\'Error: \' + e);\r\n }\r" +
|
|
"\n ajaxLoading.hide();\r\n " +
|
|
" }\r\n });\r\n });\r\n " +
|
|
" })();\r\n </script>\r\n </td>\r\n </tr" +
|
|
">\r\n </table>\r\n</div>\r\n<div");
|
|
|
|
WriteLiteral(" class=\"actionBar\"");
|
|
|
|
WriteLiteral(">\r\n <button");
|
|
|
|
WriteLiteral(" id=\"Config_AuthRoles_Actions_Delete_Button\"");
|
|
|
|
WriteLiteral(" type=\"button\"");
|
|
|
|
WriteLiteral(" class=\"button\"");
|
|
|
|
WriteLiteral(">Delete</button>\r\n <div");
|
|
|
|
WriteLiteral(" id=\"Config_AuthRoles_Actions_Delete_Dialog\"");
|
|
|
|
WriteLiteral(" class=\"dialog\"");
|
|
|
|
WriteLiteral(" title=\"Delete this Authorization Role?\"");
|
|
|
|
WriteLiteral(">\r\n");
|
|
|
|
|
|
#line 307 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 307 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
using (Html.BeginForm(MVC.API.AuthorizationRole.Delete(Model.Token.Role.Id, true)))
|
|
{
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 309 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
Write(Html.AntiForgeryToken());
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 309 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
|
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" <p>\r\n <i");
|
|
|
|
WriteLiteral(" class=\"fa fa-exclamation-triangle fa-lg warning\"");
|
|
|
|
WriteLiteral("></i>\r\n This item will be permanently deleted and cannot be recovered." +
|
|
"<br />\r\n <br />\r\n Are you sure?\r\n </p>\r\n </div>\r" +
|
|
"\n <script");
|
|
|
|
WriteLiteral(" type=\"text/javascript\"");
|
|
|
|
WriteLiteral(@">
|
|
$(function () {
|
|
let buttonDialog = null;
|
|
$('#Config_AuthRoles_Actions_Delete_Button').click(function () {
|
|
if (!buttonDialog) {
|
|
buttonDialog = $('#Config_AuthRoles_Actions_Delete_Dialog').dialog({
|
|
resizable: false,
|
|
modal: true,
|
|
autoOpen: false,
|
|
buttons: {
|
|
""Delete"": function () {
|
|
$(this)
|
|
.dialog(""option"", ""buttons"", null)
|
|
.find('form').trigger('submit');
|
|
},
|
|
Cancel: function () {
|
|
$(this).dialog(""close"");
|
|
}
|
|
}
|
|
});
|
|
}
|
|
buttonDialog.dialog('open');
|
|
});
|
|
|
|
});
|
|
</script>
|
|
</div>
|
|
");
|
|
|
|
}
|
|
}
|
|
}
|
|
#pragma warning restore 1591
|