mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-08-23 13:06:48 +08:00
全面修正分级授权,去掉Anonymous,采用Authenticate进行授权
This commit is contained in:
parent
b3c6df2931
commit
855f97df7d
@ -50,8 +50,9 @@ namespace OpenAuth.App
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Categorys = _repository.LoadInOrgs(pageindex, pagesize, GetSubCategories(parentId));
|
var ids = GetSubCategories(parentId);
|
||||||
total = _repository.GetCategoryCntInOrgs(parentId);
|
Categorys = _repository.LoadInOrgs(pageindex, pagesize, ids);
|
||||||
|
total = _repository.GetCategoryCntInOrgs(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new
|
return new
|
||||||
|
@ -34,8 +34,9 @@ namespace OpenAuth.App
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Modules = _repository.LoadInOrgs(pageindex, pagesize, GetSubOrgIds(parentId));
|
var ids = GetSubOrgIds(parentId);
|
||||||
total = _repository.GetModuleCntInOrgs(parentId);
|
Modules = _repository.LoadInOrgs(pageindex, pagesize, ids);
|
||||||
|
total = _repository.GetModuleCntInOrgs(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new
|
return new
|
||||||
|
@ -49,8 +49,9 @@ namespace OpenAuth.App
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
users = _repository.LoadInOrgs(pageindex, pagesize, GetSubOrgIds(orgId));
|
var ids = GetSubOrgIds(orgId);
|
||||||
total = _repository.GetUserCntInOrgs(orgId);
|
users = _repository.LoadInOrgs(pageindex, pagesize, ids);
|
||||||
|
total = _repository.GetUserCntInOrgs(ids);
|
||||||
}
|
}
|
||||||
var userviews = new List<UserView>();
|
var userviews = new List<UserView>();
|
||||||
foreach (var user in users)
|
foreach (var user in users)
|
||||||
|
@ -1,17 +1,14 @@
|
|||||||
// ***********************************************************************
|
// ***********************************************************************
|
||||||
// Assembly : OpenAuth.Mvc
|
// Assembly : OpenAuth.Mvc
|
||||||
// Author : yubaolee
|
// Author : yubaolee
|
||||||
// Created : 04-16-2016
|
// Created : 04-19-2016
|
||||||
//
|
//
|
||||||
// Last Modified By : yubaolee
|
// Last Modified By : yubaolee
|
||||||
// Last Modified On : 04-16-2016
|
// Last Modified On : 05-26-2016
|
||||||
|
// Contact : www.cnblogs.com/yubaolee
|
||||||
|
// File: assignModuleElement.js
|
||||||
|
//Description: 分配模块菜单(按钮)
|
||||||
// ***********************************************************************
|
// ***********************************************************************
|
||||||
// <copyright file="userRes.js" company="www.cnblogs.com/yubaolee">
|
|
||||||
// 版权所有(C) 2015
|
|
||||||
// </copyright>
|
|
||||||
// <summary>分配模块菜单(按钮)</summary>
|
|
||||||
// ***********************************************************************
|
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$.CurrentDialog.find("#btnAccess").on("click", function () {
|
$.CurrentDialog.find("#btnAccess").on("click", function () {
|
||||||
|
@ -97,7 +97,7 @@ var ztree = function () {
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
$.getJSON('/OrgManager/LoadForTree', function (json) {
|
$.getJSON('/OrgManager/LoadOrg', function (json) {
|
||||||
zTreeObj = $.fn.zTree.init($.CurrentDialog.find("#tree"), setting, json);
|
zTreeObj = $.fn.zTree.init($.CurrentDialog.find("#tree"), setting, json);
|
||||||
zTreeObj.expandAll(true);
|
zTreeObj.expandAll(true);
|
||||||
});
|
});
|
||||||
|
@ -1,4 +1,46 @@
|
|||||||
|
//左边分类导航树
|
||||||
|
var ztree = function () {
|
||||||
|
var url = '/OrgManager/LoadOrg';
|
||||||
|
var setting = {
|
||||||
|
view: { selectedMulti: false },
|
||||||
|
data: {
|
||||||
|
key: {
|
||||||
|
name: 'Name',
|
||||||
|
title: 'Name'
|
||||||
|
},
|
||||||
|
simpleData: {
|
||||||
|
enable: true,
|
||||||
|
idKey: 'Id',
|
||||||
|
pIdKey: 'ParentId',
|
||||||
|
rootPId: 'null'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
callback: {
|
||||||
|
onClick: function (event, treeId, treeNode) {
|
||||||
|
list.reload(treeNode.Id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var load = function () {
|
||||||
|
$.getJSON(url, function (json) {
|
||||||
|
var zTreeObj = $.fn.zTree.init($("#orgtree"), setting, json);
|
||||||
|
var firstId; //tree的第一个ID
|
||||||
|
if (json.length > 0) {
|
||||||
|
firstId = json[0].Id;
|
||||||
|
} else {
|
||||||
|
firstId = -1;
|
||||||
|
}
|
||||||
|
list.reload(firstId);
|
||||||
|
zTreeObj.expandAll(true);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
load();
|
||||||
|
|
||||||
|
return {
|
||||||
|
reload: load
|
||||||
|
}
|
||||||
|
}();
|
||||||
|
|
||||||
//grid列表模块
|
//grid列表模块
|
||||||
function MainGrid() {
|
function MainGrid() {
|
||||||
var url = '/OrgManager/LoadChildren?Id=';
|
var url = '/OrgManager/LoadChildren?Id=';
|
||||||
@ -57,7 +99,7 @@ function MainGrid() {
|
|||||||
align: 'center'
|
align: 'center'
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
dataUrl: url + selectedId,
|
data: [],
|
||||||
fullGrid: true,
|
fullGrid: true,
|
||||||
showLinenumber: true,
|
showLinenumber: true,
|
||||||
showCheckboxcol: true,
|
showCheckboxcol: true,
|
||||||
@ -74,41 +116,6 @@ function MainGrid() {
|
|||||||
MainGrid.prototype = new Grid();
|
MainGrid.prototype = new Grid();
|
||||||
var list = new MainGrid();
|
var list = new MainGrid();
|
||||||
|
|
||||||
//左边分类导航树
|
|
||||||
var ztree = function () {
|
|
||||||
var url = '/OrgManager/LoadOrg';
|
|
||||||
var setting = {
|
|
||||||
view: { selectedMulti: false },
|
|
||||||
data: {
|
|
||||||
key: {
|
|
||||||
name: 'Name',
|
|
||||||
title: 'Name'
|
|
||||||
},
|
|
||||||
simpleData: {
|
|
||||||
enable: true,
|
|
||||||
idKey: 'Id',
|
|
||||||
pIdKey: 'ParentId',
|
|
||||||
rootPId: 'null'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
callback: { onClick: zTreeOnClick }
|
|
||||||
};
|
|
||||||
$.getJSON(url, function (json) {
|
|
||||||
$.fn.zTree.init($("#tree"), setting, json).expandAll(true);
|
|
||||||
});
|
|
||||||
function zTreeOnClick(event, treeId, treeNode) {
|
|
||||||
list.reload(treeNode.Id);
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
reload: function () {
|
|
||||||
$.getJSON(url, function (json) {
|
|
||||||
$.fn.zTree.init($("#tree"), setting, json).expandAll(true);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}();
|
|
||||||
|
|
||||||
//编辑时,选择上级弹出的树
|
//编辑时,选择上级弹出的树
|
||||||
var parentTree = function () {
|
var parentTree = function () {
|
||||||
var nameDom = "#ParentName";
|
var nameDom = "#ParentName";
|
||||||
@ -156,7 +163,7 @@ var parentTree = function () {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
show: function () {
|
show: function () {
|
||||||
$.getJSON('/OrgManager/LoadForTree', function (json) {
|
$.getJSON('/OrgManager/LoadOrg', function (json) {
|
||||||
zTreeObj = $.fn.zTree.init($('#j_select_tree1'), setting, json);
|
zTreeObj = $.fn.zTree.init($('#j_select_tree1'), setting, json);
|
||||||
var orgstr = $(idDom).val();
|
var orgstr = $(idDom).val();
|
||||||
var name = '';
|
var name = '';
|
||||||
|
@ -1,4 +1,46 @@
|
|||||||
|
//左边分类导航树
|
||||||
|
var orgtree = function () {
|
||||||
|
var url = '/OrgManager/LoadOrg';
|
||||||
|
var setting = {
|
||||||
|
view: { selectedMulti: false },
|
||||||
|
data: {
|
||||||
|
key: {
|
||||||
|
name: 'Name',
|
||||||
|
title: 'Name'
|
||||||
|
},
|
||||||
|
simpleData: {
|
||||||
|
enable: true,
|
||||||
|
idKey: 'Id',
|
||||||
|
pIdKey: 'ParentId',
|
||||||
|
rootPId: 'null'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
callback: {
|
||||||
|
onClick: function (event, treeId, treeNode) {
|
||||||
|
list.reload(treeNode.Id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var load = function () {
|
||||||
|
$.getJSON(url, function (json) {
|
||||||
|
var zTreeObj = $.fn.zTree.init($("#orgtree"), setting, json);
|
||||||
|
var firstId; //tree的第一个ID
|
||||||
|
if (json.length > 0) {
|
||||||
|
firstId = json[0].Id;
|
||||||
|
} else {
|
||||||
|
firstId = -1;
|
||||||
|
}
|
||||||
|
list.reload(firstId);
|
||||||
|
zTreeObj.expandAll(true);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
load();
|
||||||
|
|
||||||
|
return {
|
||||||
|
reload: load
|
||||||
|
}
|
||||||
|
}();
|
||||||
|
|
||||||
//grid列表模块
|
//grid列表模块
|
||||||
function MainGrid() {
|
function MainGrid() {
|
||||||
var url = '/RoleManager/Load?orgId=';
|
var url = '/RoleManager/Load?orgId=';
|
||||||
@ -39,7 +81,7 @@ function MainGrid() {
|
|||||||
width: 100
|
width: 100
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
dataUrl: url + selectedId,
|
data:[],
|
||||||
fullGrid: true,
|
fullGrid: true,
|
||||||
showLinenumber: true,
|
showLinenumber: true,
|
||||||
showCheckboxcol: true,
|
showCheckboxcol: true,
|
||||||
@ -56,41 +98,6 @@ function MainGrid() {
|
|||||||
MainGrid.prototype = new Grid();
|
MainGrid.prototype = new Grid();
|
||||||
var list = new MainGrid();
|
var list = new MainGrid();
|
||||||
|
|
||||||
//左边分类导航树
|
|
||||||
var orgtree = function () {
|
|
||||||
var url = '/OrgManager/LoadOrg';
|
|
||||||
var setting = {
|
|
||||||
view: { selectedMulti: false },
|
|
||||||
data: {
|
|
||||||
key: {
|
|
||||||
name: 'Name',
|
|
||||||
title: 'Name'
|
|
||||||
},
|
|
||||||
simpleData: {
|
|
||||||
enable: true,
|
|
||||||
idKey: 'Id',
|
|
||||||
pIdKey: 'ParentId',
|
|
||||||
rootPId: 'null'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
callback: { onClick: zTreeOnClick }
|
|
||||||
};
|
|
||||||
$.getJSON(url, function (json) {
|
|
||||||
$.fn.zTree.init($("#orgtree"), setting, json).expandAll(true);
|
|
||||||
});
|
|
||||||
function zTreeOnClick(event, treeId, treeNode) {
|
|
||||||
list.reload(treeNode.Id);
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
reload: function () {
|
|
||||||
$.getJSON(url, function (json) {
|
|
||||||
$.fn.zTree.init($("#orgtree"), setting, json).expandAll(true);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}();
|
|
||||||
|
|
||||||
//编辑时,选择上级弹出的树
|
//编辑时,选择上级弹出的树
|
||||||
var parentTree = function () {
|
var parentTree = function () {
|
||||||
var nameDom = "#OrgName";
|
var nameDom = "#OrgName";
|
||||||
@ -138,7 +145,7 @@ var parentTree = function () {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
show: function () {
|
show: function () {
|
||||||
$.getJSON('/OrgManager/LoadForTree', function (json) {
|
$.getJSON('/OrgManager/LoadOrg', function (json) {
|
||||||
zTreeObj = $.fn.zTree.init($('#j_select_tree1'), setting, json);
|
zTreeObj = $.fn.zTree.init($('#j_select_tree1'), setting, json);
|
||||||
var orgstr = $(idDom).val();
|
var orgstr = $(idDom).val();
|
||||||
var name = '';
|
var name = '';
|
||||||
|
@ -1,4 +1,45 @@
|
|||||||
|
//左边分类导航树
|
||||||
|
var tree = function () {
|
||||||
|
var url = '/OrgManager/LoadOrg';
|
||||||
|
var setting = {
|
||||||
|
view: { selectedMulti: false },
|
||||||
|
data: {
|
||||||
|
key: {
|
||||||
|
name: 'Name',
|
||||||
|
title: 'Name'
|
||||||
|
},
|
||||||
|
simpleData: {
|
||||||
|
enable: true,
|
||||||
|
idKey: 'Id',
|
||||||
|
pIdKey: 'ParentId',
|
||||||
|
rootPId: 'null'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
callback: {
|
||||||
|
onClick: function (event, treeId, treeNode) {
|
||||||
|
list.reload(treeNode.Id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var load = function () {
|
||||||
|
$.getJSON(url, function (json) {
|
||||||
|
var zTreeObj = $.fn.zTree.init($("#tree"), setting, json);
|
||||||
|
var firstId; //tree的第一个ID
|
||||||
|
if (json.length > 0) {
|
||||||
|
firstId = json[0].Id;
|
||||||
|
} else {
|
||||||
|
firstId = -1;
|
||||||
|
}
|
||||||
|
list.reload(firstId);
|
||||||
|
zTreeObj.expandAll(true);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
load();
|
||||||
|
|
||||||
|
return {
|
||||||
|
reload: load
|
||||||
|
}
|
||||||
|
}();
|
||||||
//grid列表模块
|
//grid列表模块
|
||||||
function MainGrid() {
|
function MainGrid() {
|
||||||
var url = '/StockManager/Load?parentId=';
|
var url = '/StockManager/Load?parentId=';
|
||||||
@ -53,7 +94,7 @@ function MainGrid() {
|
|||||||
width: 100
|
width: 100
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
dataUrl: url + selectedId,
|
data:[],
|
||||||
fullGrid: true,
|
fullGrid: true,
|
||||||
showLinenumber: true,
|
showLinenumber: true,
|
||||||
showCheckboxcol: true,
|
showCheckboxcol: true,
|
||||||
@ -70,41 +111,6 @@ function MainGrid() {
|
|||||||
MainGrid.prototype = new Grid();
|
MainGrid.prototype = new Grid();
|
||||||
var list = new MainGrid();
|
var list = new MainGrid();
|
||||||
|
|
||||||
//左边分类导航树
|
|
||||||
var ztree = function () {
|
|
||||||
var url = '/OrgManager/LoadOrg';
|
|
||||||
var setting = {
|
|
||||||
view: { selectedMulti: false },
|
|
||||||
data: {
|
|
||||||
key: {
|
|
||||||
name: 'Name',
|
|
||||||
title: 'Name'
|
|
||||||
},
|
|
||||||
simpleData: {
|
|
||||||
enable: true,
|
|
||||||
idKey: 'Id',
|
|
||||||
pIdKey: 'ParentId',
|
|
||||||
rootPId: 'null'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
callback: { onClick: zTreeOnClick }
|
|
||||||
};
|
|
||||||
$.getJSON(url, function (json) {
|
|
||||||
$.fn.zTree.init($("#tree"), setting, json).expandAll(true);
|
|
||||||
});
|
|
||||||
function zTreeOnClick(event, treeId, treeNode) {
|
|
||||||
list.reload(treeNode.Id);
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
reload: function () {
|
|
||||||
$.getJSON(url, function (json) {
|
|
||||||
$.fn.zTree.init($("#tree"), setting, json).expandAll(true);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}();
|
|
||||||
|
|
||||||
//编辑时,选择上级弹出的树
|
//编辑时,选择上级弹出的树
|
||||||
var parentTree = function () {
|
var parentTree = function () {
|
||||||
var nameDom = "#ParentName";
|
var nameDom = "#ParentName";
|
||||||
@ -152,7 +158,7 @@ var parentTree = function () {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
show: function () {
|
show: function () {
|
||||||
$.getJSON('/OrgManager/LoadForTree', function (json) {
|
$.getJSON('/OrgManager/LoadOrg', function (json) {
|
||||||
zTreeObj = $.fn.zTree.init($('#j_select_tree1'), setting, json);
|
zTreeObj = $.fn.zTree.init($('#j_select_tree1'), setting, json);
|
||||||
var orgstr = $(idDom).val();
|
var orgstr = $(idDom).val();
|
||||||
var name = '';
|
var name = '';
|
||||||
|
@ -70,7 +70,7 @@ function UserRolesList() {
|
|||||||
width: 100
|
width: 100
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
dataUrl: '/RoleManager/LoadForOrgAndUser?orgId=' + selectedId + '&userId=' + $('#userId').val(),
|
data:[],
|
||||||
fullGrid: true,
|
fullGrid: true,
|
||||||
showLinenumber: true,
|
showLinenumber: true,
|
||||||
showCheckboxcol: true,
|
showCheckboxcol: true,
|
||||||
@ -105,8 +105,16 @@ var ztree = function () {
|
|||||||
callback: { onClick: zTreeOnClick }
|
callback: { onClick: zTreeOnClick }
|
||||||
};
|
};
|
||||||
$.getJSON('/OrgManager/LoadOrg', function (json) {
|
$.getJSON('/OrgManager/LoadOrg', function (json) {
|
||||||
var zTreeObj = $.fn.zTree.init($.CurrentDialog.find("#tree"), setting, json);
|
var zTreeObj = $.fn.zTree.init($("#tree"), setting, json);
|
||||||
|
var firstId; //tree的第一个ID
|
||||||
|
if (json.length > 0) {
|
||||||
|
firstId = json[0].Id;
|
||||||
|
} else {
|
||||||
|
firstId = -1;
|
||||||
|
}
|
||||||
|
userRolesList.reload(firstId);
|
||||||
zTreeObj.expandAll(true);
|
zTreeObj.expandAll(true);
|
||||||
|
|
||||||
});
|
});
|
||||||
}();
|
}();
|
||||||
function zTreeOnClick(event, treeId, treeNode) {
|
function zTreeOnClick(event, treeId, treeNode) {
|
||||||
|
@ -1,4 +1,46 @@
|
|||||||
|
//左边分类导航树
|
||||||
|
var maintree = function () {
|
||||||
|
var url = '/OrgManager/LoadOrg';
|
||||||
|
var setting = {
|
||||||
|
view: { selectedMulti: false },
|
||||||
|
data: {
|
||||||
|
key: {
|
||||||
|
name: 'Name',
|
||||||
|
title: 'Name'
|
||||||
|
},
|
||||||
|
simpleData: {
|
||||||
|
enable: true,
|
||||||
|
idKey: 'Id',
|
||||||
|
pIdKey: 'ParentId',
|
||||||
|
rootPId: 'null'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
callback: {
|
||||||
|
onClick: function (event, treeId, treeNode) {
|
||||||
|
list.reload(treeNode.Id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var load = function () {
|
||||||
|
$.getJSON(url, function (json) {
|
||||||
|
var zTreeObj = $.fn.zTree.init($("#orgtree"), setting, json);
|
||||||
|
var firstId; //tree的第一个ID
|
||||||
|
if (json.length > 0) {
|
||||||
|
firstId = json[0].Id;
|
||||||
|
} else {
|
||||||
|
firstId = -1;
|
||||||
|
}
|
||||||
|
list.reload(firstId);
|
||||||
|
zTreeObj.expandAll(true);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
load();
|
||||||
|
|
||||||
|
return {
|
||||||
|
reload: load
|
||||||
|
}
|
||||||
|
}();
|
||||||
|
|
||||||
//grid列表模块
|
//grid列表模块
|
||||||
function MainGrid() {
|
function MainGrid() {
|
||||||
var url = '/UserManager/Load?orgId=';
|
var url = '/UserManager/Load?orgId=';
|
||||||
@ -47,7 +89,7 @@ function MainGrid() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
],
|
],
|
||||||
dataUrl: url + selectedId,
|
data:[],
|
||||||
fullGrid: true,
|
fullGrid: true,
|
||||||
showLinenumber: true,
|
showLinenumber: true,
|
||||||
showCheckboxcol: true,
|
showCheckboxcol: true,
|
||||||
@ -56,6 +98,7 @@ function MainGrid() {
|
|||||||
showTfoot: false,
|
showTfoot: false,
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.reload = function (id) {
|
this.reload = function (id) {
|
||||||
if (id != undefined) selectedId = id;
|
if (id != undefined) selectedId = id;
|
||||||
this.maingrid.datagrid('reload', { dataUrl: url + selectedId });
|
this.maingrid.datagrid('reload', { dataUrl: url + selectedId });
|
||||||
@ -64,42 +107,6 @@ function MainGrid() {
|
|||||||
MainGrid.prototype = new Grid();
|
MainGrid.prototype = new Grid();
|
||||||
var list = new MainGrid();
|
var list = new MainGrid();
|
||||||
|
|
||||||
//左边分类导航树
|
|
||||||
var maintree = function () {
|
|
||||||
var url = '/OrgManager/LoadOrg';
|
|
||||||
var setting = {
|
|
||||||
view: { selectedMulti: false },
|
|
||||||
data: {
|
|
||||||
key: {
|
|
||||||
name: 'Name',
|
|
||||||
title: 'Name'
|
|
||||||
},
|
|
||||||
simpleData: {
|
|
||||||
enable: true,
|
|
||||||
idKey: 'Id',
|
|
||||||
pIdKey: 'ParentId',
|
|
||||||
rootPId: 'null'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
callback: {
|
|
||||||
onClick: function(event, treeId, treeNode) {
|
|
||||||
list.reload(treeNode.Id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
$.getJSON(url, function (json) {
|
|
||||||
$.fn.zTree.init($("#orgtree"), setting, json).expandAll(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
return {
|
|
||||||
reload: function () {
|
|
||||||
$.getJSON(url, function (json) {
|
|
||||||
$.fn.zTree.init($("#orgtree"), setting, json).expandAll(true);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}();
|
|
||||||
|
|
||||||
//编辑时,选择上级弹出的树
|
//编辑时,选择上级弹出的树
|
||||||
var parentTree = function () {
|
var parentTree = function () {
|
||||||
var nameDom = "#Organizations";
|
var nameDom = "#Organizations";
|
||||||
|
@ -46,10 +46,10 @@ namespace OpenAuth.Mvc.Controllers
|
|||||||
if (function == null)
|
if (function == null)
|
||||||
throw new Exception("未能找到Action");
|
throw new Exception("未能找到Action");
|
||||||
|
|
||||||
var anonymous = function.GetCustomAttribute(typeof(AnonymousAttribute));
|
var authorize = function.GetCustomAttribute(typeof(AuthenticateAttribute));
|
||||||
var module = loginUser.Modules.FirstOrDefault(u => u.Url.ToLower().Contains(controllername));
|
var module = loginUser.Modules.FirstOrDefault(u => u.Url.ToLower().Contains(controllername));
|
||||||
//当前登录用户没有Action记录&&Action没有anonymous标识
|
//当前登录用户没有Action记录&&Action没有anonymous标识
|
||||||
if (module == null && anonymous == null)
|
if (authorize != null && module == null)
|
||||||
{
|
{
|
||||||
filterContext.Result = new RedirectResult("/Login/Index");
|
filterContext.Result = new RedirectResult("/Login/Index");
|
||||||
return;
|
return;
|
||||||
|
@ -4,6 +4,7 @@ using System.Web.Mvc;
|
|||||||
using Infrastructure;
|
using Infrastructure;
|
||||||
using OpenAuth.App;
|
using OpenAuth.App;
|
||||||
using OpenAuth.Domain;
|
using OpenAuth.Domain;
|
||||||
|
using OpenAuth.Mvc.Models;
|
||||||
|
|
||||||
namespace OpenAuth.Mvc.Controllers
|
namespace OpenAuth.Mvc.Controllers
|
||||||
{
|
{
|
||||||
@ -18,6 +19,7 @@ namespace OpenAuth.Mvc.Controllers
|
|||||||
|
|
||||||
//
|
//
|
||||||
// GET: /UserManager/
|
// GET: /UserManager/
|
||||||
|
[Authenticate]
|
||||||
public ActionResult Index()
|
public ActionResult Index()
|
||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
@ -33,16 +35,7 @@ namespace OpenAuth.Mvc.Controllers
|
|||||||
|
|
||||||
public string LoadForTree()
|
public string LoadForTree()
|
||||||
{
|
{
|
||||||
var models = _app.LoadAll();
|
return JsonHelper.Instance.Serialize(_app.LoadAll());
|
||||||
//添加根节点
|
|
||||||
models.Add(new Category
|
|
||||||
{
|
|
||||||
Id = 0,
|
|
||||||
ParentId = -1,
|
|
||||||
Name = "根结点",
|
|
||||||
CascadeId = "0"
|
|
||||||
});
|
|
||||||
return JsonHelper.Instance.Serialize(models);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//添加或修改Category
|
//添加或修改Category
|
||||||
|
@ -16,26 +16,22 @@ namespace OpenAuth.Mvc.Controllers
|
|||||||
_app = AutofacExt.GetFromFac<ModuleManagerApp>();
|
_app = AutofacExt.GetFromFac<ModuleManagerApp>();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Anonymous]
|
|
||||||
public string GetModules(int parentId = 0)
|
public string GetModules(int parentId = 0)
|
||||||
{
|
{
|
||||||
return JsonHelper.Instance.Serialize(_app.LoadByParent(parentId));
|
return JsonHelper.Instance.Serialize(_app.LoadByParent(parentId));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Anonymous]
|
|
||||||
public ActionResult Index()
|
public ActionResult Index()
|
||||||
{
|
{
|
||||||
var user = AutofacExt.GetFromFac<LoginApp>().GetLoginUser();
|
var user = AutofacExt.GetFromFac<LoginApp>().GetLoginUser();
|
||||||
return View(user.Modules);
|
return View(user.Modules);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Anonymous]
|
|
||||||
public ActionResult Main()
|
public ActionResult Main()
|
||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Anonymous]
|
|
||||||
public ActionResult Git()
|
public ActionResult Git()
|
||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
@ -46,7 +42,6 @@ namespace OpenAuth.Mvc.Controllers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>ActionResult.</returns>
|
/// <returns>ActionResult.</returns>
|
||||||
[ChildActionOnly]
|
[ChildActionOnly]
|
||||||
[Anonymous]
|
|
||||||
public ActionResult MenuHeader()
|
public ActionResult MenuHeader()
|
||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
|
@ -31,18 +31,15 @@ namespace OpenAuth.Mvc.Controllers
|
|||||||
{
|
{
|
||||||
_app = AutofacExt.GetFromFac<ModuleElementManagerApp>();
|
_app = AutofacExt.GetFromFac<ModuleElementManagerApp>();
|
||||||
}
|
}
|
||||||
[Anonymous]
|
|
||||||
public ActionResult Index(int id)
|
public ActionResult Index(int id)
|
||||||
{
|
{
|
||||||
ViewBag.ModuleId = id;
|
ViewBag.ModuleId = id;
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
[Anonymous]
|
|
||||||
public ActionResult Get(int moduleId = 0)
|
public ActionResult Get(int moduleId = 0)
|
||||||
{
|
{
|
||||||
return Json(_app.LoadByModuleId(moduleId));
|
return Json(_app.LoadByModuleId(moduleId));
|
||||||
}
|
}
|
||||||
[Anonymous]
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public string AddOrEditButton(ModuleElement button)
|
public string AddOrEditButton(ModuleElement button)
|
||||||
{
|
{
|
||||||
@ -57,7 +54,6 @@ namespace OpenAuth.Mvc.Controllers
|
|||||||
}
|
}
|
||||||
return JsonHelper.Instance.Serialize(_bjuiResponse);
|
return JsonHelper.Instance.Serialize(_bjuiResponse);
|
||||||
}
|
}
|
||||||
[Anonymous]
|
|
||||||
public string Del(string moduleElements)
|
public string Del(string moduleElements)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -80,14 +76,12 @@ namespace OpenAuth.Mvc.Controllers
|
|||||||
/// <param name="firstId">The first identifier.</param>
|
/// <param name="firstId">The first identifier.</param>
|
||||||
/// <param name="key">The key.</param>
|
/// <param name="key">The key.</param>
|
||||||
/// <returns>ActionResult.</returns>
|
/// <returns>ActionResult.</returns>
|
||||||
[Anonymous]
|
|
||||||
public ActionResult AssignModuleElement(int firstId, string key)
|
public ActionResult AssignModuleElement(int firstId, string key)
|
||||||
{
|
{
|
||||||
ViewBag.FirstId = firstId;
|
ViewBag.FirstId = firstId;
|
||||||
ViewBag.ModuleType = key;
|
ViewBag.ModuleType = key;
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
[Anonymous]
|
|
||||||
public string LoadWithAccess(int tId, int firstId, string key)
|
public string LoadWithAccess(int tId, int firstId, string key)
|
||||||
{
|
{
|
||||||
return JsonHelper.Instance.Serialize(_app.LoadWithAccess(key, firstId, tId));
|
return JsonHelper.Instance.Serialize(_app.LoadWithAccess(key, firstId, tId));
|
||||||
|
@ -6,6 +6,7 @@ using System.Linq;
|
|||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using Infrastructure.Helper;
|
using Infrastructure.Helper;
|
||||||
using OpenAuth.App.ViewModel;
|
using OpenAuth.App.ViewModel;
|
||||||
|
using OpenAuth.Mvc.Models;
|
||||||
|
|
||||||
namespace OpenAuth.Mvc.Controllers
|
namespace OpenAuth.Mvc.Controllers
|
||||||
{
|
{
|
||||||
@ -18,8 +19,8 @@ namespace OpenAuth.Mvc.Controllers
|
|||||||
_app = AutofacExt.GetFromFac<ModuleManagerApp>();
|
_app = AutofacExt.GetFromFac<ModuleManagerApp>();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// GET: /ModuleManager/
|
// GET: /ModuleManager/
|
||||||
|
[Authenticate]
|
||||||
public ActionResult Index()
|
public ActionResult Index()
|
||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
@ -52,14 +53,6 @@ namespace OpenAuth.Mvc.Controllers
|
|||||||
public string LoadModuleWithRoot()
|
public string LoadModuleWithRoot()
|
||||||
{
|
{
|
||||||
var orgs = AutofacExt.GetFromFac<LoginApp>().GetLoginUser().Modules.MapToList<ModuleView>();
|
var orgs = AutofacExt.GetFromFac<LoginApp>().GetLoginUser().Modules.MapToList<ModuleView>();
|
||||||
//添加根节点
|
|
||||||
orgs.Add(new Module
|
|
||||||
{
|
|
||||||
Id = 0,
|
|
||||||
ParentId = -1,
|
|
||||||
Name = "根节点",
|
|
||||||
CascadeId = "0"
|
|
||||||
});
|
|
||||||
return JsonHelper.Instance.Serialize(orgs);
|
return JsonHelper.Instance.Serialize(orgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,11 +22,11 @@ namespace OpenAuth.Mvc.Controllers
|
|||||||
|
|
||||||
//
|
//
|
||||||
// GET: /OrgManager/
|
// GET: /OrgManager/
|
||||||
|
[Authenticate]
|
||||||
public ActionResult Index()
|
public ActionResult Index()
|
||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ActionResult Assign(int firstId, string key)
|
public ActionResult Assign(int firstId, string key)
|
||||||
{
|
{
|
||||||
ViewBag.FirstId = firstId;
|
ViewBag.FirstId = firstId;
|
||||||
@ -34,40 +34,14 @@ namespace OpenAuth.Mvc.Controllers
|
|||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 返回当前登录用户可访问到的部门
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>System.String.</returns>
|
|
||||||
public string LoadForTree()
|
|
||||||
{
|
|
||||||
var orgs = AutofacExt.GetFromFac<LoginApp>().GetLoginUser().AccessedOrgs;
|
|
||||||
return JsonHelper.Instance.Serialize(orgs);
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// 返回带有根节点的全部部门,不受用户权限影响
|
|
||||||
/// <para>可以匿名访问</para>
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>System.String.</returns>
|
|
||||||
[Anonymous]
|
|
||||||
public string LoadOrg()
|
public string LoadOrg()
|
||||||
{
|
{
|
||||||
var orgs = AutofacExt.GetFromFac<LoginApp>().GetLoginUser().AccessedOrgs.MapToList<Org>();
|
return JsonHelper.Instance.Serialize(AutofacExt.GetFromFac<LoginApp>().GetLoginUser().AccessedOrgs);
|
||||||
//添加根节点
|
|
||||||
orgs.Add(new Org
|
|
||||||
{
|
|
||||||
Id = 0,
|
|
||||||
ParentId = -1,
|
|
||||||
Name = "根结点",
|
|
||||||
CascadeId = "0"
|
|
||||||
});
|
|
||||||
return JsonHelper.Instance.Serialize(orgs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string LoadForUser(int firstId)
|
public string LoadForUser(int firstId)
|
||||||
{
|
{
|
||||||
var orgs = _orgApp.LoadForUser(firstId);
|
var orgs = _orgApp.LoadForUser(firstId);
|
||||||
//添加根节点
|
|
||||||
|
|
||||||
return JsonHelper.Instance.Serialize(orgs);
|
return JsonHelper.Instance.Serialize(orgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@ namespace OpenAuth.Mvc.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Anonymous]
|
|
||||||
public string Assign(string type, int firstId, string secIds)
|
public string Assign(string type, int firstId, string secIds)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -36,7 +35,6 @@ namespace OpenAuth.Mvc.Controllers
|
|||||||
return JsonHelper.Instance.Serialize(BjuiResponse);
|
return JsonHelper.Instance.Serialize(BjuiResponse);
|
||||||
}
|
}
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Anonymous]
|
|
||||||
public string UnAssign(string type, int firstId, string secIds)
|
public string UnAssign(string type, int firstId, string secIds)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -4,6 +4,7 @@ using OpenAuth.Domain;
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
|
using OpenAuth.Mvc.Models;
|
||||||
|
|
||||||
namespace OpenAuth.Mvc.Controllers
|
namespace OpenAuth.Mvc.Controllers
|
||||||
{
|
{
|
||||||
@ -18,6 +19,7 @@ namespace OpenAuth.Mvc.Controllers
|
|||||||
|
|
||||||
//
|
//
|
||||||
// GET: /UserManager/
|
// GET: /UserManager/
|
||||||
|
[Authenticate]
|
||||||
public ActionResult Index()
|
public ActionResult Index()
|
||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
@ -50,14 +52,6 @@ namespace OpenAuth.Mvc.Controllers
|
|||||||
public string LoadForTree()
|
public string LoadForTree()
|
||||||
{
|
{
|
||||||
var models = _app.LoadAll();
|
var models = _app.LoadAll();
|
||||||
//添加根节点
|
|
||||||
models.Add(new Resource
|
|
||||||
{
|
|
||||||
Id = 0,
|
|
||||||
ParentId = -1,
|
|
||||||
Name = "根结点",
|
|
||||||
CascadeId = "0"
|
|
||||||
});
|
|
||||||
return JsonHelper.Instance.Serialize(models);
|
return JsonHelper.Instance.Serialize(models);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ using OpenAuth.Domain;
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
|
using OpenAuth.Mvc.Models;
|
||||||
|
|
||||||
namespace OpenAuth.Mvc.Controllers
|
namespace OpenAuth.Mvc.Controllers
|
||||||
{
|
{
|
||||||
@ -18,6 +19,7 @@ namespace OpenAuth.Mvc.Controllers
|
|||||||
|
|
||||||
//
|
//
|
||||||
// GET: /RoleManager/
|
// GET: /RoleManager/
|
||||||
|
[Authenticate]
|
||||||
public ActionResult Index()
|
public ActionResult Index()
|
||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
@ -66,7 +68,6 @@ namespace OpenAuth.Mvc.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
#region 为用户设置角色界面
|
#region 为用户设置角色界面
|
||||||
|
|
||||||
public ActionResult LookupMulti(int userId)
|
public ActionResult LookupMulti(int userId)
|
||||||
{
|
{
|
||||||
ViewBag.UserId = userId;
|
ViewBag.UserId = userId;
|
||||||
|
@ -3,6 +3,7 @@ using OpenAuth.App;
|
|||||||
using OpenAuth.Domain;
|
using OpenAuth.Domain;
|
||||||
using System;
|
using System;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
|
using OpenAuth.Mvc.Models;
|
||||||
|
|
||||||
namespace OpenAuth.Mvc.Controllers
|
namespace OpenAuth.Mvc.Controllers
|
||||||
{
|
{
|
||||||
@ -21,6 +22,7 @@ namespace OpenAuth.Mvc.Controllers
|
|||||||
|
|
||||||
//
|
//
|
||||||
// GET: /UserManager/
|
// GET: /UserManager/
|
||||||
|
[Authenticate]
|
||||||
public ActionResult Index()
|
public ActionResult Index()
|
||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
|
@ -4,6 +4,7 @@ using System.Web.Mvc;
|
|||||||
using Infrastructure;
|
using Infrastructure;
|
||||||
using OpenAuth.App;
|
using OpenAuth.App;
|
||||||
using OpenAuth.App.ViewModel;
|
using OpenAuth.App.ViewModel;
|
||||||
|
using OpenAuth.Mvc.Models;
|
||||||
|
|
||||||
namespace OpenAuth.Mvc.Controllers
|
namespace OpenAuth.Mvc.Controllers
|
||||||
{
|
{
|
||||||
@ -18,6 +19,7 @@ namespace OpenAuth.Mvc.Controllers
|
|||||||
|
|
||||||
//
|
//
|
||||||
// GET: /UserManager/
|
// GET: /UserManager/
|
||||||
|
[Authenticate]
|
||||||
public ActionResult Index()
|
public ActionResult Index()
|
||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
|
@ -5,10 +5,12 @@ using System.Web;
|
|||||||
|
|
||||||
namespace OpenAuth.Mvc.Models
|
namespace OpenAuth.Mvc.Models
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 允许匿名访问
|
/// 必须认证
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class AnonymousAttribute :Attribute
|
public class AuthenticateAttribute : Attribute
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -146,7 +146,7 @@
|
|||||||
<Compile Include="Global.asax.cs">
|
<Compile Include="Global.asax.cs">
|
||||||
<DependentUpon>Global.asax</DependentUpon>
|
<DependentUpon>Global.asax</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Models\AnonymousAttribute.cs" />
|
<Compile Include="Models\AuthenticateAttribute.cs" />
|
||||||
<Compile Include="Models\BJUIResponse.cs" />
|
<Compile Include="Models\BJUIResponse.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -36,7 +36,7 @@ namespace OpenAuth.Repository
|
|||||||
cascadeId = org.CascadeId;
|
cascadeId = org.CascadeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Find(u => u.CascadeId.Contains(cascadeId) && u.Id != orgId);
|
return Find(u => u.CascadeId.Contains(cascadeId));
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<Org> GetSubWithOwn(int orgId)
|
public IEnumerable<Org> GetSubWithOwn(int orgId)
|
||||||
|
Loading…
Reference in New Issue
Block a user