mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2026-04-08 01:51:28 +08:00
流程跳转
This commit is contained in:
@@ -24,9 +24,10 @@ namespace OpenAuth.App
|
||||
var user = new UserWithAccessedCtrls
|
||||
{
|
||||
User = _service.User,
|
||||
AccessedOrgs = _service.Orgs,
|
||||
Orgs = _service.Orgs,
|
||||
Modules = _service.Modules.MapToList<ModuleView>(),
|
||||
Resources = _service.Resources,
|
||||
Roles = _service.Roles
|
||||
};
|
||||
|
||||
foreach (var moduleView in user.Modules)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using OpenAuth.App.ViewModel;
|
||||
using OpenAuth.Domain;
|
||||
using OpenAuth.Domain.Interface;
|
||||
@@ -62,5 +61,10 @@ namespace OpenAuth.App
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public void Del(Guid id)
|
||||
{
|
||||
_repository.Delete(u =>u.Id == id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,6 +41,10 @@
|
||||
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="OptimaJet.Workflow.Core, Version=1.5.5.0, Culture=neutral, PublicKeyToken=3d29392dccd464d7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\WorkflowEngine.NET-Core.1.5.5.2\lib\net45\OptimaJet.Workflow.Core.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
@@ -99,6 +103,8 @@
|
||||
<Compile Include="UserManagerApp.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="OrgManagerApp.cs" />
|
||||
<Compile Include="ViewModel\CommandModel.cs" />
|
||||
<Compile Include="ViewModel\GoodsApplyVM.cs" />
|
||||
<Compile Include="ViewModel\GridData.cs" />
|
||||
<Compile Include="ViewModel\UserWithAccessedCtrls.cs" />
|
||||
<Compile Include="ViewModel\ModuleElementVM.cs" />
|
||||
|
||||
@@ -80,8 +80,7 @@ namespace OpenAuth.App
|
||||
/// </summary>
|
||||
private Guid[] GetSubOrgIds(Guid orgId)
|
||||
{
|
||||
var org = _orgRepository.FindSingle(u => u.Id == orgId);
|
||||
var orgs = _orgRepository.Find(u => u.CascadeId.Contains(org.CascadeId)).Select(u => u.Id).ToArray();
|
||||
var orgs = _orgRepository.GetSubOrgs(orgId).Select(u => u.Id).ToArray();
|
||||
return orgs;
|
||||
}
|
||||
|
||||
@@ -116,22 +115,21 @@ namespace OpenAuth.App
|
||||
_relevanceRepository.AddRelevance("RoleOrg", orgIds.ToLookup(u => role.Id));
|
||||
}
|
||||
|
||||
public List<Role> LoadForUser(Guid userId)
|
||||
{
|
||||
return _repository.LoadForUser(userId).ToList();
|
||||
}
|
||||
|
||||
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 userroles = LoadForUser(userId);
|
||||
var orgroles = _repository.LoadInOrgs(GetSubOrgIds(orgId)).ToList();
|
||||
|
||||
var roleIds = _repository.Find(u => orgId == Guid.Empty
|
||||
|| (roles.Contains(u.Id))).ToList(); //从角色表里获取
|
||||
var rolevms = new List<RoleVM>();
|
||||
foreach (var role in roleIds)
|
||||
foreach (var role in orgroles)
|
||||
{
|
||||
RoleVM rolevm = role;
|
||||
rolevm.IsBelongUser = (_relevanceRepository.FindSingle(u => u.SecondId == role.Id
|
||||
&& u.FirstId == userId
|
||||
&& u.Key == "UserRole")
|
||||
!= null);
|
||||
rolevm.IsBelongUser = userroles.Any(u => u.Id == role.Id);
|
||||
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());
|
||||
|
||||
25
OpenAuth.App/ViewModel/CommandModel.cs
Normal file
25
OpenAuth.App/ViewModel/CommandModel.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : OpenAuth.App
|
||||
// Author : yubaolee
|
||||
// Created : 09-05-2016
|
||||
//
|
||||
// Last Modified By : yubaolee
|
||||
// Last Modified On : 09-05-2016
|
||||
// Contact : Microsoft
|
||||
// File: CommandModel.cs
|
||||
// ***********************************************************************
|
||||
|
||||
using OptimaJet.Workflow.Core.Model;
|
||||
|
||||
namespace OpenAuth.App.ViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// workflow命令
|
||||
/// </summary>
|
||||
public class CommandModel
|
||||
{
|
||||
public string Key { get; set; }
|
||||
public string Value { get; set; }
|
||||
public TransitionClassifier Classifier { get; set; }
|
||||
}
|
||||
}
|
||||
73
OpenAuth.App/ViewModel/GoodsApplyVM.cs
Normal file
73
OpenAuth.App/ViewModel/GoodsApplyVM.cs
Normal file
@@ -0,0 +1,73 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <autogenerated>
|
||||
// This code was generated by a CodeSmith Template.
|
||||
//
|
||||
// DO NOT MODIFY contents of this file. Changes to this
|
||||
// file will be lost if the code is regenerated.
|
||||
// Author:Yubao Li
|
||||
// </autogenerated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Infrastructure;
|
||||
using OpenAuth.Domain;
|
||||
|
||||
namespace OpenAuth.App.ViewModel
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class GoodsApplyVM :Entity
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int Sort { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int Number { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string Comment { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string State { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string StateName { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public System.Guid UserId { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public System.Guid? ControllerUserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 可用命令
|
||||
/// </summary>
|
||||
public CommandModel[] Commands { get; set; }
|
||||
|
||||
public Dictionary<string, string> AvailiableStates { get; set; }
|
||||
|
||||
public static implicit operator GoodsApplyVM(GoodsApply obj)
|
||||
{
|
||||
return obj.MapTo<GoodsApplyVM>();
|
||||
}
|
||||
|
||||
public static implicit operator GoodsApply(GoodsApplyVM obj)
|
||||
{
|
||||
return obj.MapTo<GoodsApply>();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -39,10 +39,8 @@ namespace OpenAuth.App.ViewModel
|
||||
/// </summary>
|
||||
public List<Org> Orgs { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户可访问的机构
|
||||
/// </summary>
|
||||
public IEnumerable<Org> AccessedOrgs { get; set; }
|
||||
|
||||
public List<Role> Roles { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,4 +5,5 @@
|
||||
<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" />
|
||||
<package id="WorkflowEngine.NET-Core" version="1.5.5.2" targetFramework="net45" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user