mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-07-15 14:04:41 +08:00
更改PDM文件
删除为用户分配可见机构(本身有机构功能) 删除为角色分配机构(本身有机构多对多功能)
This commit is contained in:
parent
d5a6ffe3b8
commit
56d5ea0e8a
@ -37,6 +37,10 @@
|
||||
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
|
@ -90,8 +90,8 @@ namespace OpenAuth.App
|
||||
var moduleIds =
|
||||
_relevanceRepository.Find(
|
||||
u =>
|
||||
(u.FirstId == userId && u.Key == "UserAccessedOrg") ||
|
||||
(u.Key == "RoleAccessedOrg" && userRoleIds.Contains(u.FirstId))).Select(u => u.SecondId).ToList();
|
||||
(u.FirstId == userId && u.Key == "UserOrg") ||
|
||||
(u.Key == "RoleOrg" && userRoleIds.Contains(u.FirstId))).Select(u => u.SecondId).ToList();
|
||||
|
||||
if (!moduleIds.Any()) return new List<Org>();
|
||||
return _repository.Find(u => moduleIds.Contains(u.Id)).ToList();
|
||||
@ -104,7 +104,7 @@ namespace OpenAuth.App
|
||||
public List<Org> LoadForRole(Guid roleId)
|
||||
{
|
||||
var moduleIds =
|
||||
_relevanceRepository.Find(u => u.FirstId == roleId && u.Key == "RoleAccessedOrg")
|
||||
_relevanceRepository.Find(u => u.FirstId == roleId && u.Key == "RoleOrg")
|
||||
.Select(u => u.SecondId)
|
||||
.ToList();
|
||||
if (!moduleIds.Any()) return new List<Org>();
|
||||
|
@ -5,6 +5,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Dynamic;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace OpenAuth.App
|
||||
{
|
||||
@ -38,7 +39,7 @@ namespace OpenAuth.App
|
||||
/// <summary>
|
||||
/// 加载一个部门及子部门全部Roles
|
||||
/// </summary>
|
||||
public dynamic Load(Guid orgId, int pageindex, int pagesize)
|
||||
public GridData Load(Guid orgId, int pageindex, int pagesize)
|
||||
{
|
||||
if (pageindex < 1) pageindex = 1; //TODO:如果列表为空新增加一个用户后,前端会传一个0过来,奇怪??
|
||||
IEnumerable<Role> roles;
|
||||
@ -54,10 +55,22 @@ namespace OpenAuth.App
|
||||
total = _repository.GetRoleCntInOrgs(orgId);
|
||||
}
|
||||
|
||||
dynamic result = new ExpandoObject();
|
||||
result.total = total;
|
||||
result.list = roles.ToList();
|
||||
result.pageCurrent = pageindex;
|
||||
var rolevms = new List<RoleVM>();
|
||||
foreach (var role in roles)
|
||||
{
|
||||
RoleVM rolevm = role;
|
||||
var orgs = _orgRepository.LoadByRole(role.Id);
|
||||
rolevm.Organizations = string.Join(",", orgs.Select(u => u.Name).ToList());
|
||||
rolevm.OrganizationIds = string.Join(",", orgs.Select(u => u.Id).ToList());
|
||||
rolevms.Add(rolevm);
|
||||
}
|
||||
|
||||
var result = new GridData
|
||||
{
|
||||
total = total,
|
||||
list = rolevms.ToList(),
|
||||
pageCurrent = pageindex
|
||||
};
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -84,8 +97,9 @@ namespace OpenAuth.App
|
||||
_repository.Delete(id);
|
||||
}
|
||||
|
||||
public void AddOrUpdate(Role role)
|
||||
public void AddOrUpdate(JObject obj)
|
||||
{
|
||||
var role = obj.ToObject<Role>();
|
||||
if (role.Id == Guid.Empty)
|
||||
{
|
||||
role.CreateTime = DateTime.Now;
|
||||
@ -95,13 +109,21 @@ namespace OpenAuth.App
|
||||
{
|
||||
_repository.Update(role);
|
||||
}
|
||||
|
||||
Guid[] orgIds = obj["OrganizationIds"].ToString().Split(',').Select(id => Guid.Parse(id)).ToArray();
|
||||
|
||||
_relevanceRepository.DeleteBy("RoleOrg", role.Id);
|
||||
_relevanceRepository.AddRelevance("RoleOrg", orgIds.ToLookup(u => role.Id));
|
||||
}
|
||||
|
||||
public List<RoleVM> LoadForOrgAndUser(Guid orgId, Guid userId)
|
||||
{
|
||||
var allorgs = GetSubOrgIds(orgId);
|
||||
var roles = _relevanceRepository.Find(u => u.Key == "RoleOrg"
|
||||
&& allorgs.Contains(u.SecondId)).Select(u =>u.FirstId).ToList(); //机构关联的角色
|
||||
|
||||
var roleIds = _repository.Find(u => orgId == Guid.Empty
|
||||
|| (u.OrgId != null &&allorgs.Contains(u.OrgId.Value))).ToList();
|
||||
|| (roles.Contains(u.Id))).ToList(); //从角色表里获取
|
||||
var rolevms = new List<RoleVM>();
|
||||
foreach (var role in roleIds)
|
||||
{
|
||||
@ -110,6 +132,9 @@ namespace OpenAuth.App
|
||||
&& u.FirstId == userId
|
||||
&& u.Key == "UserRole")
|
||||
!= null);
|
||||
var orgs = _orgRepository.LoadByRole(role.Id);
|
||||
rolevm.Organizations = string.Join(",", orgs.Select(u => u.Name).ToList());
|
||||
rolevm.OrganizationIds = string.Join(",", orgs.Select(u => u.Id).ToList());
|
||||
rolevms.Add(rolevm);
|
||||
}
|
||||
return rolevms;
|
||||
|
@ -32,18 +32,25 @@ namespace OpenAuth.App.ViewModel
|
||||
/// <returns></returns>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前状态
|
||||
/// </summary>
|
||||
public int Status { get; set; }
|
||||
/// <summary>
|
||||
/// 角色类型
|
||||
/// </summary>
|
||||
public int Type { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 所属部门节点语义ID
|
||||
/// 所属组织名称,多个可用,分隔
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string OrgCascadeId { get; set; }
|
||||
public string Organizations { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属部门名称
|
||||
/// 所属组织ID,多个可用,分隔
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string OrgName { get; set; }
|
||||
public string OrganizationIds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///是否属于某用户
|
||||
|
@ -4,4 +4,5 @@
|
||||
<package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net45" />
|
||||
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
|
||||
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
|
||||
</packages>
|
@ -12,6 +12,8 @@ namespace OpenAuth.Domain.Interface
|
||||
|
||||
IEnumerable<Org> LoadByUser(Guid userId);
|
||||
|
||||
IEnumerable<Org> LoadByRole(Guid roleId);
|
||||
|
||||
/// <summary>
|
||||
/// 得到全部子部门
|
||||
/// </summary>
|
||||
|
@ -24,8 +24,6 @@ namespace OpenAuth.Domain
|
||||
this.Type= 0;
|
||||
this.CreateTime= DateTime.Now;
|
||||
this.CreateId= string.Empty;
|
||||
this.OrgCascadeId= string.Empty;
|
||||
this.OrgName= string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -48,18 +46,6 @@ namespace OpenAuth.Domain
|
||||
/// 创建人ID
|
||||
/// </summary>
|
||||
public string CreateId { get; set; }
|
||||
/// <summary>
|
||||
/// 所属部门节点语义ID
|
||||
/// </summary>
|
||||
public string OrgCascadeId { get; set; }
|
||||
/// <summary>
|
||||
/// 所属部门名称
|
||||
/// </summary>
|
||||
public string OrgName { get; set; }
|
||||
/// <summary>
|
||||
/// 所属部门流水号
|
||||
/// </summary>
|
||||
public System.Guid? OrgId { get; set; }
|
||||
|
||||
}
|
||||
}
|
@ -130,8 +130,8 @@ namespace OpenAuth.Domain.Service
|
||||
//用户角色与自己分配到的机构ID
|
||||
var orgids = _unitWork.Find<Relevance>(
|
||||
u =>
|
||||
(u.FirstId == _user.Id && u.Key == "UserAccessedOrg") ||
|
||||
(u.Key == "RoleAccessedOrg" && userRoleIds.Contains(u.FirstId))).Select(u => u.SecondId);
|
||||
(u.FirstId == _user.Id && u.Key == "UserOrg") ||
|
||||
(u.Key == "RoleOrg" && userRoleIds.Contains(u.FirstId))).Select(u => u.SecondId);
|
||||
_orgs = _unitWork.Find<Org>(u => orgids.Contains(u.Id)).ToList();
|
||||
}
|
||||
|
||||
|
@ -176,4 +176,4 @@ var selected = function () {
|
||||
|
||||
selected.reLoad();
|
||||
|
||||
//@@ sourceURL=assignOrg.js
|
||||
//@@ sourceURL=assignModule.js
|
||||
|
@ -1,179 +0,0 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : OpenAuth.Mvc
|
||||
// Author : yubaolee
|
||||
// Created : 04-16-2016
|
||||
//
|
||||
// Last Modified By : yubaolee
|
||||
// Last Modified On : 04-16-2016
|
||||
// ***********************************************************************
|
||||
// <copyright file="userRes.js" company="www.cnblogs.com/yubaolee">
|
||||
// 版权所有(C) 2015
|
||||
// </copyright>
|
||||
// <summary>分配组织</summary>
|
||||
// ***********************************************************************
|
||||
|
||||
|
||||
$(document).ready(function () {
|
||||
$.CurrentDialog.find("#btnAccess").on("click", function () {
|
||||
var ids = ztree.getSelected();
|
||||
if (ids == null) return;
|
||||
|
||||
$.post('/RelevanceManager/Assign', {
|
||||
type: $("#moduleType").val(),
|
||||
firstId: $('#firstId').val(),
|
||||
secIds: ids
|
||||
}, function (json) {
|
||||
json = $.parseJSON(json);
|
||||
if (json.statusCode != "200") {
|
||||
$(this).alertmsg('warn', json.message);
|
||||
return;
|
||||
}
|
||||
selected.reLoad();
|
||||
});
|
||||
});
|
||||
$.CurrentDialog.find("#btnDelAccess").on("click", function () {
|
||||
var ids = selected.getSelected();
|
||||
if (ids == null) return;
|
||||
|
||||
$.post('/RelevanceManager/UnAssign', {
|
||||
type: $("#moduleType").val(),
|
||||
firstId: $('#firstId').val(),
|
||||
secIds: ids
|
||||
}, function (json) {
|
||||
json = $.parseJSON(json);
|
||||
if (json.statusCode != "200") {
|
||||
$(this).alertmsg('warn', json.message);
|
||||
return;
|
||||
}
|
||||
selected.reLoad();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
//待选的树
|
||||
var ztree = function () {
|
||||
var moduleIds = new Array();
|
||||
var zTreeObj;
|
||||
var setting = {
|
||||
view: {
|
||||
selectedMulti: false
|
||||
},
|
||||
check: {
|
||||
enable: true,
|
||||
chkStyle: "checkbox",
|
||||
chkboxType: { "Y": "", "N": "" } //去掉勾选时级联
|
||||
},
|
||||
data: {
|
||||
key: {
|
||||
name: 'Name',
|
||||
title: 'Name'
|
||||
},
|
||||
simpleData: {
|
||||
enable: true,
|
||||
idKey: 'Id',
|
||||
pIdKey: 'ParentId',
|
||||
rootPId: 'null'
|
||||
}
|
||||
},
|
||||
callback: {
|
||||
onClick: zTreeOnClick,
|
||||
onCheck: zTreeCheck
|
||||
}
|
||||
};
|
||||
|
||||
function zTreeCheck(e, treeId, treeNode) {
|
||||
var nodes = zTreeObj.getCheckedNodes(true);
|
||||
if (nodes.length != 0) {
|
||||
moduleIds = nodes.map(function (e) { return e.Id; });
|
||||
}
|
||||
}
|
||||
function zTreeOnClick(event, treeId, treeNode) {
|
||||
zTreeObj.checkNode(treeNode, !treeNode.checked, true, true);
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
$.getJSON('/OrgManager/LoadOrg', function (json) {
|
||||
zTreeObj = $.fn.zTree.init($.CurrentDialog.find("#tree"), setting, json);
|
||||
zTreeObj.expandAll(true);
|
||||
});
|
||||
|
||||
return {
|
||||
getSelected: function() {
|
||||
return moduleIds;
|
||||
}
|
||||
}
|
||||
}();
|
||||
|
||||
|
||||
//已分配的机构
|
||||
var selected = function () {
|
||||
var moduleIds = new Array();
|
||||
var zTreeObj;
|
||||
var setting = {
|
||||
view: {
|
||||
selectedMulti: false
|
||||
},
|
||||
check: {
|
||||
enable: true,
|
||||
chkStyle: "checkbox",
|
||||
chkboxType: { "Y": "", "N": "" } //去掉勾选时级联
|
||||
},
|
||||
data: {
|
||||
key: {
|
||||
name: 'Name',
|
||||
title: 'Name'
|
||||
},
|
||||
simpleData: {
|
||||
enable: true,
|
||||
idKey: 'Id',
|
||||
pIdKey: 'ParentId',
|
||||
rootPId: 'null'
|
||||
}
|
||||
},
|
||||
callback: {
|
||||
onClick: zTreeOnClick,
|
||||
onCheck: zTreeCheck
|
||||
}
|
||||
};
|
||||
|
||||
function zTreeCheck(e, treeId, treeNode) {
|
||||
var nodes = zTreeObj.getCheckedNodes(true);
|
||||
if (nodes.length != 0) {
|
||||
moduleIds = nodes.map(function (e) { return e.Id; });
|
||||
}
|
||||
}
|
||||
function zTreeOnClick(event, treeId, treeNode) {
|
||||
zTreeObj.checkNode(treeNode, !treeNode.checked, true, true);
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
var load = function() {
|
||||
var url;
|
||||
var type = $("#moduleType").val();
|
||||
if (type == "UserAccessedOrg") {
|
||||
url = '/OrgManager/LoadForUser';
|
||||
} else {
|
||||
url = '/OrgManager/LoadForRole';
|
||||
}
|
||||
$.getJSON(url, {
|
||||
firstId: $('#firstId').val()
|
||||
}, function (json) {
|
||||
zTreeObj = $.fn.zTree.init($.CurrentDialog.find("#selected"), setting, json);
|
||||
zTreeObj.expandAll(true);
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
getSelected: function () {
|
||||
return moduleIds;
|
||||
},
|
||||
reLoad: function() {
|
||||
return load();
|
||||
}
|
||||
}
|
||||
}();
|
||||
|
||||
selected.reLoad();
|
||||
|
||||
//@@ sourceURL=assignOrg.js
|
@ -76,7 +76,7 @@ function MainGrid() {
|
||||
items: [{ '0': '默认' }, { '1': '状态1' }],
|
||||
},
|
||||
{
|
||||
name: 'OrgName',
|
||||
name: 'Organizations',
|
||||
label: '所属部门名称',
|
||||
width: 100
|
||||
},
|
||||
@ -100,8 +100,8 @@ var list = new MainGrid();
|
||||
|
||||
//编辑时,选择上级弹出的树
|
||||
var parentTree = function () {
|
||||
var nameDom = "#OrgName";
|
||||
var idDom = "#OrgId";
|
||||
var nameDom = "#Organizations";
|
||||
var idDom = "#OrganizationIds";
|
||||
var zTreeObj;
|
||||
var setting = {
|
||||
view: {
|
||||
@ -109,8 +109,8 @@ var parentTree = function () {
|
||||
},
|
||||
check: {
|
||||
enable: true,
|
||||
chkStyle: "radio", //单选
|
||||
radioType: "all"
|
||||
chkStyle: "checkbox",
|
||||
chkboxType: { "Y": "", "N": "" } //去掉勾选时级联
|
||||
},
|
||||
data: {
|
||||
key: {
|
||||
@ -130,6 +130,7 @@ var parentTree = function () {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function zTreeCheck(event, treeId, treeNode) {
|
||||
var nodes = zTreeObj.getCheckedNodes(true);
|
||||
var ids = nodes.map(function (e) { return e.Id; }).join(",");
|
||||
@ -189,8 +190,7 @@ var editDlg = function () {
|
||||
$('#Name').val(ret.Name);
|
||||
$('#Status').selectpicker('val', ret.Status);
|
||||
$('#Type').selectpicker('val', ret.Type);
|
||||
$('#OrgId').val(ret.OrgId);
|
||||
$('#OrgName').val(ret.OrgName);
|
||||
$("#OrganizationIds").val(ret.OrganizationIds);
|
||||
parentTree.show();
|
||||
},
|
||||
save: function () { //编辑-->保存
|
||||
@ -264,24 +264,6 @@ function assignRoleModule(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
//为角色分配可见机构
|
||||
function assignRoleOrg(obj) {
|
||||
var selected = list.getSelectedObj();
|
||||
if (selected == null) return;
|
||||
|
||||
$(obj).dialog({
|
||||
id: 'accessRoleOrg',
|
||||
url: '/OrgManager/Assign',
|
||||
title: '为角色分配可见部门',
|
||||
width: 620,
|
||||
height: 500,
|
||||
data: {
|
||||
firstId: selected.Id,
|
||||
key: "RoleAccessedOrg"
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//为角色分配资源
|
||||
function openRoleReourceAccess(obj) {
|
||||
var selected = list.getSelectedObj();
|
||||
|
@ -57,7 +57,7 @@ function UserRolesList() {
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
name: 'OrgName',
|
||||
name: 'Organizations',
|
||||
label: '所属组织',
|
||||
width: 100
|
||||
},
|
||||
|
@ -275,24 +275,6 @@ function openUserModuleAccess(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
//用户可见组织授权按钮
|
||||
function openUserOrgAccess(obj) {
|
||||
var selected = list.getSelectedObj();
|
||||
if (selected == null) return;
|
||||
|
||||
$(obj).dialog({
|
||||
id: 'accessUserOrg',
|
||||
url: '/OrgManager/Assign',
|
||||
title: '为用户分配可见部门',
|
||||
width: 620,
|
||||
height: 500,
|
||||
data: {
|
||||
firstId: selected.Id,
|
||||
key: "UserAccessedOrg"
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//用户角色授权
|
||||
function openUserRoleAccess(obj) {
|
||||
var selected = list.getSelectedObj();
|
||||
|
@ -3,7 +3,9 @@ using OpenAuth.App;
|
||||
using OpenAuth.Domain;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Web.Http;
|
||||
using System.Web.Mvc;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using OpenAuth.Mvc.Models;
|
||||
|
||||
namespace OpenAuth.Mvc.Controllers
|
||||
@ -26,12 +28,12 @@ namespace OpenAuth.Mvc.Controllers
|
||||
}
|
||||
|
||||
//添加或修改角色
|
||||
[HttpPost]
|
||||
public string Add(Role role)
|
||||
[System.Web.Mvc.HttpPost]
|
||||
public string Add([FromBody]JObject obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
_app.AddOrUpdate(role);
|
||||
_app.AddOrUpdate(obj);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -4,7 +4,9 @@ using System.Web.Mvc;
|
||||
using System.Web.Optimization;
|
||||
using System.Web.Routing;
|
||||
using Infrastructure;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using OpenAuth.Mvc.Controllers;
|
||||
using OpenAuth.Mvc.Models;
|
||||
|
||||
namespace OpenAuth.Mvc
|
||||
{
|
||||
@ -20,6 +22,8 @@ namespace OpenAuth.Mvc
|
||||
RouteConfig.RegisterRoutes(RouteTable.Routes);
|
||||
BundleConfig.RegisterBundles(BundleTable.Bundles);
|
||||
|
||||
ModelBinders.Binders.Add(typeof(JObject), new JobjectModelBinder());
|
||||
|
||||
LogHelper.Log("启动Web");
|
||||
}
|
||||
|
||||
|
25
OpenAuth.Mvc/Models/JobjectModelBinder.cs
Normal file
25
OpenAuth.Mvc/Models/JobjectModelBinder.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using System.Web.Mvc;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace OpenAuth.Mvc.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// 将前端传来的FormData数据转为Jobject类型
|
||||
/// 注:前端如果是application/json,可以直接转JOjbect!
|
||||
/// </summary>
|
||||
public class JobjectModelBinder :IModelBinder
|
||||
{
|
||||
public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
|
||||
{
|
||||
//todo:需要判断前端是否是FormData
|
||||
var obj = new JObject();
|
||||
var request = controllerContext.HttpContext.Request;
|
||||
foreach (var key in request.Form.AllKeys)
|
||||
{
|
||||
obj[key] = request.Form[key];
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -23,6 +23,7 @@
|
||||
<UseGlobalApplicationHostFile />
|
||||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
|
||||
<RestorePackages>true</RestorePackages>
|
||||
<WebGreaseLibPath>..\packages\WebGrease.1.5.2\lib</WebGreaseLibPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@ -82,6 +83,10 @@
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Entity" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
@ -92,6 +97,10 @@
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Http, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
@ -132,6 +141,10 @@
|
||||
<Reference Include="System.Web.Optimization">
|
||||
<HintPath>..\packages\Microsoft.AspNet.Web.Optimization.1.1.1\lib\net40\System.Web.Optimization.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="WebGrease, Version=1.5.2.14234, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\WebGrease.1.5.2\lib\WebGrease.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="App_Start\BundleConfig.cs" />
|
||||
@ -153,6 +166,7 @@
|
||||
<Compile Include="Controllers\RoleManagerController.cs" />
|
||||
<Compile Include="Controllers\StockManagerController.cs" />
|
||||
<Compile Include="Controllers\UserManagerController.cs" />
|
||||
<Compile Include="Models\JobjectModelBinder.cs" />
|
||||
<Compile Include="Models\WorkflowActionProvider.cs" />
|
||||
<Compile Include="Models\WorkflowInit.cs" />
|
||||
<Compile Include="Models\WorkflowRuleProvider.cs" />
|
||||
@ -165,7 +179,6 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="BllScripts\assignModule.js" />
|
||||
<Content Include="BllScripts\assignOrg.js" />
|
||||
<Content Include="BllScripts\assignModuleElement.js" />
|
||||
<Content Include="BllScripts\categoryManager.js" />
|
||||
<Content Include="BllScripts\processDetail.js" />
|
||||
@ -743,7 +756,6 @@
|
||||
<Content Include="Views\RoleManager\LookupMulti.cshtml" />
|
||||
<Content Include="Views\ResourceManager\AssignRes.cshtml" />
|
||||
<Content Include="Views\StockManager\Index.cshtml" />
|
||||
<Content Include="Views\OrgManager\Assign.cshtml" />
|
||||
<Content Include="Views\Shared\_BjuiLayout.cshtml" />
|
||||
<Content Include="Views\GoodsApplies\Index.cshtml" />
|
||||
</ItemGroup>
|
||||
|
@ -1,34 +0,0 @@
|
||||
<div class="bjui-pageHeader">
|
||||
<div class="bjui-searchBar">
|
||||
<input style="display: none" id="firstId" value="@ViewBag.FirstId" />
|
||||
<input style="display: none" id="moduleType" , value="@ViewBag.ModuleType" />
|
||||
<div class="pull-right">
|
||||
<div class="alert alert-info search-inline">
|
||||
<i class="fa fa-info-circle"></i>用户可访问的机构=其角色的机构+本身可访问的机构
|
||||
</div>
|
||||
<button type="button" class="btn btn-green" data-num="1" data-icon="plus" id="btnAccess">
|
||||
授权选中
|
||||
</button>
|
||||
<button type="button" class="btn btn-danger" data-num="1" data-icon="trash" id="btnDelAccess">
|
||||
取消授权
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="bjui-pageContent">
|
||||
<fieldset style="height: auto; float: left; width: 280px;">
|
||||
<legend>系统的机构</legend>
|
||||
<ul id="tree" class="ztree"></ul>
|
||||
</fieldset>
|
||||
|
||||
<!--已经选中的列表-->
|
||||
<fieldset style="height: auto;margin-left: 300px; width: 280px">
|
||||
<legend>已分配的机构</legend>
|
||||
<ul id="selected" class="ztree"></ul>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<script src="~/BllScripts/grid.js"></script>
|
||||
<script src="~/BllScripts/assignOrg.js"></script>
|
||||
|
@ -31,9 +31,9 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="OrgName" class="control-label x120">所属组织:</label>
|
||||
<input id="OrgId" name="OrgId" style="display: none" />
|
||||
<input type="text" name="OrgName" id="OrgName"
|
||||
<label for="Organizations" class="control-label x120">所属机构:</label>
|
||||
<input id="OrganizationIds" name="OrganizationIds" value="" style="display: none" />
|
||||
<input type="text" name="Organizations" id="Organizations"
|
||||
data-toggle="selectztree" data-tree="#j_select_tree1">
|
||||
<ul id="j_select_tree1" class="ztree hide" data-toggle="ztree"></ul>
|
||||
</td>
|
||||
|
@ -15,7 +15,8 @@
|
||||
|
||||
<connectionStrings>
|
||||
<add name="OpenAuthDBContext" connectionString="Data Source=.;Initial Catalog=OpenAuthDB;Persist Security Info=True;User ID=sa;Password=000000;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
|
||||
<add name="WorkFlow" connectionString="Data Source=.;Initial Catalog=WorkflowApp;Persist Security Info=True;User ID=sa;Password=000000;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
|
||||
|
||||
<add name="WorkFlow" connectionString="Data Source=.;Initial Catalog=Workflow.Net;Persist Security Info=True;User ID=sa;Password=000000;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
|
||||
<!--<add name="OpenAuthDBContext" connectionString="server=127.0.0.1;user id=root;persistsecurityinfo=True;database=openauth;password=123456" providerName="MySql.Data.MySqlClient" />-->
|
||||
</connectionStrings>
|
||||
|
||||
@ -62,11 +63,11 @@
|
||||
<!--系统版本,如果值为演示版本"demo"则关闭部分post功能-->
|
||||
<add key="version" value="" />
|
||||
|
||||
<add key="CommonApiUriString" value="http://localhost:52789" />
|
||||
<add key="CommonApiUriString" value="http://openauthapi.com" />
|
||||
|
||||
<!--SSO单点登录主域-->
|
||||
<!--<add key="SSOPassport" value="http://sso.com"/>-->
|
||||
<add key="SSOPassport" value="http://localhost:52789" />
|
||||
<add key="SSOPassport" value="http://openauthapi.com" />
|
||||
<!--AppKey唯一标识-->
|
||||
<add key="SSOAppKey" value="openauth" />
|
||||
|
||||
@ -81,7 +82,12 @@
|
||||
<modules>
|
||||
<remove name="FormsAuthenticationModule" />
|
||||
</modules>
|
||||
</system.webServer>
|
||||
<handlers>
|
||||
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
|
||||
<remove name="OPTIONSVerbHandler" />
|
||||
<remove name="TRACEVerbHandler" />
|
||||
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
|
||||
</handlers></system.webServer>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
|
@ -14,6 +14,8 @@
|
||||
<package id="Microsoft.AspNet.Razor.zh-Hans" version="3.2.3" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.Web.Optimization" version="1.1.1" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.Web.Optimization.zh-Hans" version="1.1.1" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.WebPages.zh-Hans" version="3.2.3" targetFramework="net45" />
|
||||
<package id="Microsoft.jQuery.Unobtrusive.Validation" version="3.0.0" targetFramework="net45" />
|
||||
@ -22,6 +24,7 @@
|
||||
<package id="MySql.Data.Entity" version="6.9.8" targetFramework="net45" />
|
||||
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
|
||||
<package id="Respond" version="1.2.0" targetFramework="net45" />
|
||||
<package id="WebGrease" version="1.5.2" targetFramework="net45" />
|
||||
<package id="WorkflowEngine.NET-Core" version="1.5.5.2" targetFramework="net45" />
|
||||
<package id="WorkflowEngine.NET-Designer" version="1.5.5.2" targetFramework="net45" />
|
||||
<package id="WorkflowEngine.NET-ProviderForMSSQL" version="1.5.5.2" targetFramework="net45" />
|
||||
|
@ -43,18 +43,6 @@ namespace OpenAuth.Repository.Models.Mapping
|
||||
.HasColumnName("CreateId")
|
||||
.HasMaxLength(64)
|
||||
.IsRequired();
|
||||
Property(t => t.OrgCascadeId)
|
||||
.HasColumnName("OrgCascadeId")
|
||||
.HasMaxLength(255)
|
||||
.IsRequired();
|
||||
Property(t => t.OrgName)
|
||||
.HasColumnName("OrgName")
|
||||
.HasMaxLength(255)
|
||||
.IsRequired();
|
||||
Property(t => t.OrgId)
|
||||
.HasColumnName("OrgId")
|
||||
.IsOptional();
|
||||
|
||||
// Relationships
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,9 @@ namespace OpenAuth.Repository
|
||||
return Find();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载用户的所有机构
|
||||
/// </summary>
|
||||
public IEnumerable<Org> LoadByUser(Guid userId)
|
||||
{
|
||||
var result = from userorg in Context.Relevances
|
||||
@ -25,6 +28,19 @@ namespace OpenAuth.Repository
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载角色的所有机构
|
||||
/// </summary>
|
||||
public IEnumerable<Org> LoadByRole(Guid roleId)
|
||||
{
|
||||
var result = from userorg in Context.Relevances
|
||||
join org in Context.Orgs on userorg.SecondId equals org.Id
|
||||
where userorg.FirstId == roleId && userorg.Key == "RoleOrg"
|
||||
select org;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
public IEnumerable<Org> GetSubOrgs(Guid orgId)
|
||||
{
|
||||
string cascadeId = "0.";
|
||||
|
@ -32,7 +32,10 @@ namespace OpenAuth.Repository
|
||||
|
||||
public IEnumerable<Role> LoadInOrgs(params Guid[] orgId)
|
||||
{
|
||||
var result = from role in Context.Roles.Where(u =>u.OrgId != null && orgId.Contains(u.OrgId.Value)) select role;
|
||||
var roles = Context.Relevances.Where(u => u.Key == "RoleOrg"
|
||||
&& orgId.Contains(u.SecondId)).Select(u => u.FirstId); //机构关联的角色
|
||||
|
||||
var result = from role in Context.Roles.Where(u =>roles.Contains(u.Id)) select role;
|
||||
|
||||
return result;
|
||||
|
||||
|
@ -11,11 +11,11 @@
|
||||
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
|
||||
|
||||
<!--SSO单点登录主域-->
|
||||
<add key="SSOPassport" value="http://localhost:52789" />
|
||||
<add key="SSOPassport" value="http://openauthapi.com" />
|
||||
<!--AppKey唯一标识-->
|
||||
<add key="SSOAppKey" value="openauthtest" />
|
||||
|
||||
<add key="OpenAuthURL" value="http://localhost:56813" />
|
||||
<add key="OpenAuthURL" value="http://openauth.com" />
|
||||
</appSettings>
|
||||
<system.web>
|
||||
<compilation debug="true" targetFramework="4.5" />
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user