Permissions & Authorization for Users #24
Initial Release; Includes Database and MVC refactoring
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
@model Disco.Web.Areas.Config.Models.AuthorizationRole.CreateModel
|
||||
@{
|
||||
Authorization.Require(Claims.DiscoAdminAccount);
|
||||
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Authorization Roles", MVC.Config.AuthorizationRole.Index(null), "Create");
|
||||
}
|
||||
@using (Html.BeginForm())
|
||||
{
|
||||
<div class="form" style="width: 450px">
|
||||
<table>
|
||||
<tr>
|
||||
<th>
|
||||
Name:
|
||||
</th>
|
||||
<td>
|
||||
@Html.EditorFor(model => model.AuthorizationRole.Name)<br />@Html.ValidationMessageFor(model => model.AuthorizationRole.Name)
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p class="actions">
|
||||
<input type="submit" class="button" value="Create" />
|
||||
</p>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
$('#AuthorizationRole_Name').focus().select();
|
||||
});
|
||||
</script>
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
#pragma warning disable 1591
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.18051
|
||||
//
|
||||
// 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.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("~/Areas/Config/Views/AuthorizationRole/Create.cshtml")]
|
||||
public partial class Create : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.AuthorizationRole.CreateModel>
|
||||
{
|
||||
public Create()
|
||||
{
|
||||
}
|
||||
public override void Execute()
|
||||
{
|
||||
|
||||
#line 2 "..\..\Areas\Config\Views\AuthorizationRole\Create.cshtml"
|
||||
|
||||
Authorization.Require(Claims.DiscoAdminAccount);
|
||||
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Authorization Roles", MVC.Config.AuthorizationRole.Index(null), "Create");
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n");
|
||||
|
||||
|
||||
#line 6 "..\..\Areas\Config\Views\AuthorizationRole\Create.cshtml"
|
||||
using (Html.BeginForm())
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <div");
|
||||
|
||||
WriteLiteral(" class=\"form\"");
|
||||
|
||||
WriteLiteral(" style=\"width: 450px\"");
|
||||
|
||||
WriteLiteral(">\r\n <table>\r\n <tr>\r\n <th>\r\n N" +
|
||||
"ame:\r\n </th>\r\n <td>\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 15 "..\..\Areas\Config\Views\AuthorizationRole\Create.cshtml"
|
||||
Write(Html.EditorFor(model => model.AuthorizationRole.Name));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("<br />");
|
||||
|
||||
|
||||
#line 15 "..\..\Areas\Config\Views\AuthorizationRole\Create.cshtml"
|
||||
Write(Html.ValidationMessageFor(model => model.AuthorizationRole.Name));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n </td>\r\n </tr>\r\n </table>\r\n <p");
|
||||
|
||||
WriteLiteral(" class=\"actions\"");
|
||||
|
||||
WriteLiteral(">\r\n <input");
|
||||
|
||||
WriteLiteral(" type=\"submit\"");
|
||||
|
||||
WriteLiteral(" class=\"button\"");
|
||||
|
||||
WriteLiteral(" value=\"Create\"");
|
||||
|
||||
WriteLiteral(" />\r\n </p>\r\n </div>\r\n");
|
||||
|
||||
WriteLiteral(" <script");
|
||||
|
||||
WriteLiteral(" type=\"text/javascript\"");
|
||||
|
||||
WriteLiteral(">\r\n $(function () {\r\n $(\'#AuthorizationRole_Name\').focus().sele" +
|
||||
"ct();\r\n });\r\n </script>\r\n");
|
||||
|
||||
|
||||
#line 28 "..\..\Areas\Config\Views\AuthorizationRole\Create.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
@@ -0,0 +1,43 @@
|
||||
@model Disco.Web.Areas.Config.Models.AuthorizationRole.IndexModel
|
||||
@{
|
||||
Authorization.Require(Claims.DiscoAdminAccount);
|
||||
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Authorization Roles");
|
||||
}
|
||||
@if (Model.Tokens.Count == 0)
|
||||
{
|
||||
<div class="form" style="width: 450px; padding: 100px 0;">
|
||||
<h2>No authorization roles are configured</h2>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="tableData">
|
||||
<tr>
|
||||
<th>Name
|
||||
</th>
|
||||
<th>Linked Groups/Users
|
||||
</th>
|
||||
</tr>
|
||||
@foreach (var item in Model.Tokens)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Html.ActionLink(item.Role.Name, MVC.Config.AuthorizationRole.Index(item.Role.Id))
|
||||
</td>
|
||||
<td>
|
||||
@if (item.SubjectIds.Count == 0)
|
||||
{
|
||||
<span class="smallMessage"><None></span>
|
||||
}
|
||||
else
|
||||
{
|
||||
@(string.Join(", ", item.SubjectIds.OrderBy(i => i)))
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
}
|
||||
<div class="actionBar">
|
||||
@Html.ActionLinkButton("Create Authorization Role", MVC.Config.AuthorizationRole.Create())
|
||||
</div>
|
||||
@@ -0,0 +1,197 @@
|
||||
#pragma warning disable 1591
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.18051
|
||||
//
|
||||
// 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.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("~/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("<div");
|
||||
|
||||
WriteLiteral(" class=\"actionBar\"");
|
||||
|
||||
WriteLiteral(">\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 42 "..\..\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
|
||||
@@ -0,0 +1,320 @@
|
||||
@model Disco.Web.Areas.Config.Models.AuthorizationRole.ShowModel
|
||||
@using Disco.Models.Authorization;
|
||||
@{
|
||||
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");
|
||||
}
|
||||
<div id="Config_AuthRoles_Show" class="form" style="width: 550px">
|
||||
<table>
|
||||
<tr>
|
||||
<th style="width: 150px">Id:
|
||||
</th>
|
||||
<td>
|
||||
@Html.DisplayFor(model => model.Token.Role.Id)
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Name:
|
||||
</th>
|
||||
<td>@Html.EditorFor(model => model.Token.Role.Name)
|
||||
@AjaxHelpers.AjaxSave()
|
||||
@AjaxHelpers.AjaxLoader()
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
document.DiscoFunctions.PropertyChangeHelper(
|
||||
$('#Token_Role_Name'),
|
||||
'Invalid Name',
|
||||
'@(Url.Action(MVC.API.AuthorizationRole.UpdateName(Model.Token.Role.Id)))',
|
||||
'RoleName'
|
||||
);
|
||||
});
|
||||
</script>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Linked Groups/Users:</th>
|
||||
<td>
|
||||
@if (Model.Token.SubjectIds.Count == 0)
|
||||
{
|
||||
<span class="smallMessage">None Associated</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<ul id="Config_AuthRoles_Subjects" class="none">
|
||||
@foreach (var sg in Model.Subjects)
|
||||
{
|
||||
<li class="@(sg.IsGroup ? "group" : "user")">@(sg.Id == sg.Name ? sg.Id : string.Format("{0} [{1}]", sg.Name, sg.Id))</li>
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
<div>
|
||||
<a id="Config_AuthRoles_Subjects_Update" href="#" class="button small">Update</a>
|
||||
<div id="Config_AuthRoles_Subjects_Update_Dialog" class="dialog" title="Authorization Role Linked Groups/Users">
|
||||
<div id="Config_AuthRoles_Subjects_Update_Dialog_ListContainer">
|
||||
<span id="Config_AuthRoles_Subjects_Update_Dialog_None" class="smallMessage">None Associated</span>
|
||||
<ul id="Config_AuthRoles_Subjects_Update_Dialog_List" class="none">
|
||||
@foreach (var sg in Model.Subjects)
|
||||
{
|
||||
<li class="@(sg.IsGroup ? "group" : "user")" data-subjectid="@sg.Id">@(sg.Id == sg.Name ? sg.Id : string.Format("{0} [{1}]", sg.Name, sg.Id)) <span class="remove"></span></li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
<div id="Config_AuthRoles_Subjects_Update_Dialog_AddContainer">
|
||||
<input type="text" id="Config_AuthRoles_Subjects_Update_Dialog_TextAdd" />
|
||||
<a id="Config_AuthRoles_Subjects_Update_Dialog_Add" href="#" class="button small">Add</a>
|
||||
</div>
|
||||
<form id="Config_AuthRoles_Subjects_Update_Dialog_Form" action="@(Url.Action(MVC.API.AuthorizationRole.UpdateSubjects(Model.Token.Role.Id, null, true)))" method="post"></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: '@(Url.Action(MVC.API.AuthorizationRole.SearchSubjects()))',
|
||||
minLength: 2,
|
||||
focus: function (e, ui) {
|
||||
textAdd.val(ui.item.Id);
|
||||
return false;
|
||||
},
|
||||
select: function (e, ui) {
|
||||
textAdd.val(ui.item.Id).blur();
|
||||
return false;
|
||||
}
|
||||
}).data('ui-autocomplete')._renderItem = function (ul, item) {
|
||||
return $("<li></li>")
|
||||
.data("item.autocomplete", item)
|
||||
.append("<a><strong>" + item.Name + "</strong><br>" + item.Id + " (" + item.Type + ")</a>")
|
||||
.appendTo(ul);
|
||||
};
|
||||
|
||||
$('#Config_AuthRoles_Subjects_Update_Dialog_Add').click(add);
|
||||
}
|
||||
|
||||
dialog.dialog('open');
|
||||
|
||||
updateNoSubjects();
|
||||
return false;
|
||||
}
|
||||
|
||||
function cancel(){
|
||||
$(this).dialog("close");
|
||||
|
||||
list.find('li').each(function(){
|
||||
$this = $(this);
|
||||
if ($this.is('[data-subjectstatus="new"]')){
|
||||
$this.remove();
|
||||
}else{
|
||||
if ($this.is('[data-subjectstatus="removed"]')){
|
||||
$this.show();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function remove(){
|
||||
$this = $(this).closest('li');
|
||||
|
||||
if ($this.is('[data-subjectstatus="new"]')){
|
||||
$this.remove();
|
||||
}else{
|
||||
$this.attr('data-subjectstatus', 'removed').hide();
|
||||
}
|
||||
|
||||
updateNoSubjects();
|
||||
}
|
||||
|
||||
function add(){
|
||||
|
||||
var id = textAdd.val();
|
||||
|
||||
$.ajax({
|
||||
url: '@Url.Action(MVC.API.AuthorizationRole.Subject())',
|
||||
method: 'get',
|
||||
data: { Id: id }
|
||||
}).done(function(response){
|
||||
if (response){
|
||||
if (list.find('li[data-subjectid="'+response.Id+'"]').length == 0){
|
||||
var li = $('<li>')
|
||||
.append($('<span>').text(response.Id == response.Name ? response.Id : response.Name + ' [' + response.Id + ']'))
|
||||
.append($('<span>').addClass('remove'))
|
||||
.addClass(response.Type)
|
||||
.attr('data-subjectid', response.Id)
|
||||
.attr('data-subjectstatus', 'new');
|
||||
|
||||
list.append(li);
|
||||
|
||||
updateNoSubjects();
|
||||
}else{
|
||||
alert('That subject has already been added');
|
||||
}
|
||||
}else{
|
||||
alert('Unknown Id');
|
||||
}
|
||||
}).fail(function(jqXHR, textStatus, errorThrown){
|
||||
alert('Error: ' + errorThrown);
|
||||
});
|
||||
}
|
||||
|
||||
function updateNoSubjects(){
|
||||
if (list.find('li:visible').length > 0)
|
||||
noSubjects.hide();
|
||||
else
|
||||
noSubjects.show();
|
||||
}
|
||||
|
||||
function saveChanges(){
|
||||
var form = $('#Config_AuthRoles_Subjects_Update_Dialog_Form').empty();
|
||||
|
||||
list.find('li[data-subjectstatus!="removed"]').each(function(){
|
||||
var subjectId = $(this).attr('data-subjectid');
|
||||
|
||||
form.append($('<input>').attr({
|
||||
'name': 'Subjects',
|
||||
'type': 'hidden'
|
||||
}).val(subjectId));
|
||||
|
||||
}).get();
|
||||
|
||||
form.submit();
|
||||
|
||||
dialog.dialog("disable");
|
||||
dialog.dialog("option", "buttons", null);
|
||||
}
|
||||
|
||||
$(function(){
|
||||
$('#Config_AuthRoles_Subjects_Update').click(showDialog);
|
||||
});
|
||||
|
||||
})();
|
||||
</script>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div id="Config_AuthRoles_Claims_Tree">
|
||||
</div>
|
||||
<div>
|
||||
<a href="#" id="Config_AuthRoles_Claims_SaveChanges" class="button small disabled">Save Changes</a>@AjaxHelpers.AjaxLoader()
|
||||
</div>
|
||||
<script>
|
||||
(function(){
|
||||
var claimNodes = @(new HtmlString(Newtonsoft.Json.JsonConvert.SerializeObject(Model.ClaimNavigatorFancyTreeNodes)));
|
||||
|
||||
$(function(){
|
||||
var saveButton = $('#Config_AuthRoles_Claims_SaveChanges');
|
||||
var ajaxLoading = saveButton.next('.ajaxLoading');
|
||||
|
||||
var tree = $('#Config_AuthRoles_Claims_Tree').fancytree({
|
||||
source: claimNodes,
|
||||
checkbox: true,
|
||||
selectMode: 3,
|
||||
select: function(){
|
||||
saveButton.removeClass('disabled');
|
||||
}
|
||||
});
|
||||
|
||||
saveButton.click(function(){
|
||||
if (!saveButton.is('.disabled')){
|
||||
var selectedNodes = tree.fancytree('getTree').getSelectedNodes();
|
||||
|
||||
var selectedKeys = [];
|
||||
for (var i = 0; i < selectedNodes.length; i++) {
|
||||
var node = selectedNodes[i];
|
||||
if (!node.folder)
|
||||
selectedKeys.push(node.key);
|
||||
}
|
||||
|
||||
ajaxLoading.show()
|
||||
|
||||
$.ajax({
|
||||
url: '@Url.Action(MVC.API.AuthorizationRole.UpdateClaims(Model.Token.Role.Id))',
|
||||
method: 'post',
|
||||
data: { ClaimKeys: selectedKeys },
|
||||
traditional: true
|
||||
}).done(function(response, result){
|
||||
if (result != 'success' || response != 'OK') {
|
||||
alert('Unable to save changes:\n' + response);
|
||||
ajaxLoading.hide();
|
||||
} else {
|
||||
saveButton.addClass('disabled');
|
||||
ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
|
||||
}
|
||||
}).fail(function(jqXHR, textStatus, errorThrown){
|
||||
alert('Error: ' + errorThrown);
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="actionBar">
|
||||
@Html.ActionLinkButton("Delete", MVC.API.AuthorizationRole.Delete(Model.Token.Role.Id, true), "Config_AuthRoles_Actions_Delete_Button")
|
||||
<div id="Config_AuthRoles_Actions_Delete_Dialog" title="Delete this Authorization Role?">
|
||||
<p>
|
||||
<span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 20px 0;"></span>
|
||||
This item will be permanently deleted and cannot be recovered.<br />
|
||||
<br />
|
||||
Are you sure?
|
||||
</p>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var button = $('#Config_AuthRoles_Actions_Delete_Button');
|
||||
var buttonDialog = $('#Config_AuthRoles_Actions_Delete_Dialog');
|
||||
var buttonLink = button.attr('href');
|
||||
button.attr('href', '#');
|
||||
button.click(function () {
|
||||
buttonDialog.dialog('open');
|
||||
return false;
|
||||
});
|
||||
buttonDialog.dialog({
|
||||
resizable: false,
|
||||
modal: true,
|
||||
autoOpen: false,
|
||||
buttons: {
|
||||
"Delete": function () {
|
||||
var $this = $(this);
|
||||
$this.dialog("disable");
|
||||
$this.dialog("option", "buttons", null);
|
||||
window.location.href = buttonLink;
|
||||
},
|
||||
Cancel: function () {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
@@ -0,0 +1,632 @@
|
||||
#pragma warning disable 1591
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.18051
|
||||
//
|
||||
// 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.BI.Extensions;
|
||||
|
||||
#line 2 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
||||
using Disco.Models.Authorization;
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
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("~/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(">Id:\r\n </th>\r\n <td>\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 17 "..\..\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>Name:\r\n " +
|
||||
" </th>\r\n <td>");
|
||||
|
||||
|
||||
#line 23 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
||||
Write(Html.EditorFor(model => model.Token.Role.Name));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 24 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
||||
Write(AjaxHelpers.AjaxSave());
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 25 "..\..\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 31 "..\..\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 41 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 41 "..\..\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 44 "..\..\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 48 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 48 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
||||
foreach (var sg in Model.Subjects)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <li");
|
||||
|
||||
WriteAttribute("class", Tuple.Create(" class=\"", 2069), Tuple.Create("\"", 2109)
|
||||
|
||||
#line 50 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 2077), Tuple.Create<System.Object, System.Int32>(sg.IsGroup ? "group" : "user"
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 2077), false)
|
||||
);
|
||||
|
||||
WriteLiteral(">");
|
||||
|
||||
|
||||
#line 50 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
||||
Write(sg.Id == sg.Name ? sg.Id : string.Format("{0} [{1}]", sg.Name, sg.Id));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</li>\r\n");
|
||||
|
||||
|
||||
#line 51 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" </ul>\r\n");
|
||||
|
||||
|
||||
#line 53 "..\..\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(">\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 60 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 60 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
||||
foreach (var sg in Model.Subjects)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <li");
|
||||
|
||||
WriteAttribute("class", Tuple.Create(" class=\"", 2982), Tuple.Create("\"", 3022)
|
||||
|
||||
#line 62 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 2990), Tuple.Create<System.Object, System.Int32>(sg.IsGroup ? "group" : "user"
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 2990), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" data-subjectid=\"");
|
||||
|
||||
|
||||
#line 62 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
||||
Write(sg.Id);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\"");
|
||||
|
||||
WriteLiteral(">");
|
||||
|
||||
|
||||
#line 62 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
||||
Write(sg.Id == sg.Name ? sg.Id : string.Format("{0} [{1}]", sg.Name, sg.Id));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <span");
|
||||
|
||||
WriteLiteral(" class=\"remove\"");
|
||||
|
||||
WriteLiteral("></span></li>\r\n");
|
||||
|
||||
|
||||
#line 63 "..\..\Areas\Config\Views\AuthorizationRole\Show.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=\"", 3681), Tuple.Create("\"", 3778)
|
||||
|
||||
#line 70 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 3690), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.AuthorizationRole.UpdateSubjects(Model.Token.Role.Id, null, true))
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 3690), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" method=\"post\"");
|
||||
|
||||
WriteLiteral("></form>\r\n </div>\r\n <script>\r\n " +
|
||||
" (function(){\r\n var dialog, textAdd, list, " +
|
||||
"noSubjects, form;\r\n \r\n fun" +
|
||||
"ction showDialog(){\r\n if (!dialog){\r\n " +
|
||||
" dialog = $(\'#Config_AuthRoles_Subjects_Update_Dialog\').d" +
|
||||
"ialog({\r\n resizable: false,\r\n " +
|
||||
" modal: true,\r\n " +
|
||||
" autoOpen: false,\r\n width: 350,\r\n " +
|
||||
" height: 420,\r\n " +
|
||||
" buttons: {\r\n \"Save Changes\": s" +
|
||||
"aveChanges,\r\n Cancel: cancel\r\n " +
|
||||
" }\r\n });\r\n\r\n " +
|
||||
" dialog.on(\'click\', \'.remove\', remove);\r\n\r\n " +
|
||||
" list = $(\'#Config_AuthRoles_Subjects_Update_Dia" +
|
||||
"log_List\');\r\n noSubjects = $(\'#Config_AuthRol" +
|
||||
"es_Subjects_Update_Dialog_None\');\r\n\r\n textAdd" +
|
||||
" = $(\'#Config_AuthRoles_Subjects_Update_Dialog_TextAdd\');\r\n\r\n " +
|
||||
" textAdd.watermark(\'Search Subjects\')\r\n " +
|
||||
" .autocomplete({\r\n sour" +
|
||||
"ce: \'");
|
||||
|
||||
|
||||
#line 99 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
||||
Write(Url.Action(MVC.API.AuthorizationRole.SearchSubjects()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\',\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 " +
|
||||
" return false;\r\n " +
|
||||
" }\r\n }).data(\'ui-autocom" +
|
||||
"plete\')._renderItem = function (ul, item) {\r\n " +
|
||||
" return $(\"<li></li>\")\r\n " +
|
||||
".data(\"item.autocomplete\", item)\r\n " +
|
||||
" .append(\"<a><strong>\" + item.Name + \"</strong><br>\" + item.Id + \" (\" + item.Ty" +
|
||||
"pe + \")</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-subjectstatus\', \'r" +
|
||||
"emoved\').hide();\r\n }\r\n\r\n " +
|
||||
" updateNoSubjects();\r\n }\r\n\r\n " +
|
||||
" function add(){\r\n \r\n " +
|
||||
" var id = textAdd.val();\r\n\r\n $.ajax({\r" +
|
||||
"\n url: \'");
|
||||
|
||||
|
||||
#line 157 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
||||
Write(Url.Action(MVC.API.AuthorizationRole.Subject()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\',\r\n method: \'get\',\r\n " +
|
||||
" data: { Id: id }\r\n }).done(function(re" +
|
||||
"sponse){\r\n if (response){\r\n " +
|
||||
" if (list.find(\'li[data-subjectid=\"\'+response.Id+\'\"]\').leng" +
|
||||
"th == 0){\r\n var li = $(\'<li>\')\r\n " +
|
||||
" .append($(\'<span>\').text(response.Id " +
|
||||
"== response.Name ? response.Id : response.Name + \' [\' + response.Id + \']\'))\r\n " +
|
||||
" .append($(\'<span>\').addClass(\'remo" +
|
||||
"ve\'))\r\n .addClass(response.Type)\r" +
|
||||
"\n .attr(\'data-subjectid\', respons" +
|
||||
"e.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 added\');" +
|
||||
"\r\n }\r\n " +
|
||||
" }else{\r\n alert(\'Unknown Id\');\r\n " +
|
||||
" }\r\n }).fail(function(j" +
|
||||
"qXHR, textStatus, errorThrown){\r\n alert(\'Erro" +
|
||||
"r: \' + errorThrown);\r\n });\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 " +
|
||||
" var form = $(\'#Config_AuthRoles_Subjects_Update_Dialog_Form\').emp" +
|
||||
"ty();\r\n\r\n list.find(\'li[data-subjectstatus!=\"remo" +
|
||||
"ved\"]\').each(function(){\r\n var subjectId = $(" +
|
||||
"this).attr(\'data-subjectid\');\r\n \r\n " +
|
||||
" form.append($(\'<input>\').attr({\r\n " +
|
||||
" \'name\': \'Subjects\',\r\n \'" +
|
||||
"type\': \'hidden\'\r\n }).val(subjectId));\r\n\r\n " +
|
||||
" }).get();\r\n\r\n form.su" +
|
||||
"bmit();\r\n\r\n dialog.dialog(\"disable\");\r\n " +
|
||||
" dialog.dialog(\"option\", \"buttons\", null);\r\n " +
|
||||
" }\r\n\r\n $(function(){\r\n " +
|
||||
" $(\'#Config_AuthRoles_Subjects_Update\').click(showDialog);\r\n " +
|
||||
" });\r\n\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 <a");
|
||||
|
||||
WriteLiteral(" href=\"#\"");
|
||||
|
||||
WriteLiteral(" id=\"Config_AuthRoles_Claims_SaveChanges\"");
|
||||
|
||||
WriteLiteral(" class=\"button small disabled\"");
|
||||
|
||||
WriteLiteral(">Save Changes</a>");
|
||||
|
||||
|
||||
#line 224 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
||||
Write(AjaxHelpers.AjaxLoader());
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n </div>\r\n <script>\r\n (function" +
|
||||
"(){\r\n var claimNodes = ");
|
||||
|
||||
|
||||
#line 228 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
||||
Write(new HtmlString(Newtonsoft.Json.JsonConvert.SerializeObject(Model.ClaimNavigatorFancyTreeNodes)));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@";
|
||||
|
||||
$(function(){
|
||||
var saveButton = $('#Config_AuthRoles_Claims_SaveChanges');
|
||||
var ajaxLoading = saveButton.next('.ajaxLoading');
|
||||
|
||||
var tree = $('#Config_AuthRoles_Claims_Tree').fancytree({
|
||||
source: claimNodes,
|
||||
checkbox: true,
|
||||
selectMode: 3,
|
||||
select: function(){
|
||||
saveButton.removeClass('disabled');
|
||||
}
|
||||
});
|
||||
|
||||
saveButton.click(function(){
|
||||
if (!saveButton.is('.disabled')){
|
||||
var selectedNodes = tree.fancytree('getTree').getSelectedNodes();
|
||||
|
||||
var selectedKeys = [];
|
||||
for (var i = 0; i < selectedNodes.length; i++) {
|
||||
var node = selectedNodes[i];
|
||||
if (!node.folder)
|
||||
selectedKeys.push(node.key);
|
||||
}
|
||||
|
||||
ajaxLoading.show()
|
||||
|
||||
$.ajax({
|
||||
url: '");
|
||||
|
||||
|
||||
#line 257 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
||||
Write(Url.Action(MVC.API.AuthorizationRole.UpdateClaims(Model.Token.Role.Id)));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"',
|
||||
method: 'post',
|
||||
data: { ClaimKeys: selectedKeys },
|
||||
traditional: true
|
||||
}).done(function(response, result){
|
||||
if (result != 'success' || response != 'OK') {
|
||||
alert('Unable to save changes:\n' + response);
|
||||
ajaxLoading.hide();
|
||||
} else {
|
||||
saveButton.addClass('disabled');
|
||||
ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
|
||||
}
|
||||
}).fail(function(jqXHR, textStatus, errorThrown){
|
||||
alert('Error: ' + errorThrown);
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div");
|
||||
|
||||
WriteLiteral(" class=\"actionBar\"");
|
||||
|
||||
WriteLiteral(">\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 283 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
|
||||
Write(Html.ActionLinkButton("Delete", MVC.API.AuthorizationRole.Delete(Model.Token.Role.Id, true), "Config_AuthRoles_Actions_Delete_Button"));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n <div");
|
||||
|
||||
WriteLiteral(" id=\"Config_AuthRoles_Actions_Delete_Dialog\"");
|
||||
|
||||
WriteLiteral(" title=\"Delete this Authorization Role?\"");
|
||||
|
||||
WriteLiteral(">\r\n <p>\r\n <span");
|
||||
|
||||
WriteLiteral(" class=\"ui-icon ui-icon-alert\"");
|
||||
|
||||
WriteLiteral(" style=\"float: left; margin: 0 7px 20px 0;\"");
|
||||
|
||||
WriteLiteral("></span>\r\n This item will be permanently deleted and cannot be recover" +
|
||||
"ed.<br />\r\n <br />\r\n Are you sure?\r\n </p>\r\n </di" +
|
||||
"v>\r\n <script");
|
||||
|
||||
WriteLiteral(" type=\"text/javascript\"");
|
||||
|
||||
WriteLiteral(@">
|
||||
$(function () {
|
||||
var button = $('#Config_AuthRoles_Actions_Delete_Button');
|
||||
var buttonDialog = $('#Config_AuthRoles_Actions_Delete_Dialog');
|
||||
var buttonLink = button.attr('href');
|
||||
button.attr('href', '#');
|
||||
button.click(function () {
|
||||
buttonDialog.dialog('open');
|
||||
return false;
|
||||
});
|
||||
buttonDialog.dialog({
|
||||
resizable: false,
|
||||
modal: true,
|
||||
autoOpen: false,
|
||||
buttons: {
|
||||
""Delete"": function () {
|
||||
var $this = $(this);
|
||||
$this.dialog(""disable"");
|
||||
$this.dialog(""option"", ""buttons"", null);
|
||||
window.location.href = buttonLink;
|
||||
},
|
||||
Cancel: function () {
|
||||
$(this).dialog(""close"");
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
Reference in New Issue
Block a user