删除domain工程

This commit is contained in:
yubao
2017-11-28 23:59:03 +08:00
parent 6a3fa6fd3d
commit ead70c2f56
5 changed files with 0 additions and 315 deletions

View File

@@ -1,55 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{6108DA8E-92A1-4ABE-B9F5-26D64D55CA2C}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OpenAuth.Domain</RootNamespace>
<AssemblyName>OpenAuth.Domain</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -1,35 +0,0 @@
using System.Reflection;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("OpenAuth.Domain")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("OpenAuth.Domain")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("b387116d-343a-462e-b2ed-b509a6be2c9b")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -1,31 +0,0 @@
using OpenAuth.Domain.Interface;
namespace OpenAuth.Domain.Service
{
/// <summary>
/// Ȩ<>޷<EFBFBD><DEB7><EFBFBD><E4B9A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>ǿ<EFBFBD><C7BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˺Ŵ<CBBA><C5B4><EFBFBD>
/// </summary>
public class AuthoriseFactory
{
private IUnitWork _unitWork;
public AuthoriseFactory(IUnitWork unitWork)
{
_unitWork = unitWork;
}
public AuthoriseService Create(string loginuser)
{
if (loginuser == "System")
{
return new SystemAuthService(_unitWork);
}
else
{
return new AuthoriseService(_unitWork)
{
User = _unitWork.FindSingle<User>(u =>u.Account == loginuser)
};
}
}
}
}

View File

@@ -1,136 +0,0 @@
// ***********************************************************************
// Assembly : OpenAuth.Domain
// Author : yubaolee
// Created : 04-21-2016
//
// Last Modified By : yubaolee
// Last Modified On : 04-21-2016
// Contact : Microsoft
// File: AuthenService.cs
// ***********************************************************************
using OpenAuth.Domain.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
namespace OpenAuth.Domain.Service
{
/// <summary>
/// 领域服务
/// <para>用户授权服务</para>
/// </summary>
public class AuthoriseService
{
protected IUnitWork _unitWork;
protected User _user;
private List<string> _userRoleIds; //用户角色GUID
public AuthoriseService(IUnitWork unitWork)
{
_unitWork = unitWork;
}
public List<Module> Modules
{
get { return GetModulesQuery().ToList(); }
}
public List<Role> Roles
{
get { return GetRolesQuery().ToList(); }
}
public List<ModuleElement> ModuleElements
{
get { return GetModuleElementsQuery().ToList(); }
}
public List<Resource> Resources
{
get { return GetResourcesQuery().ToList(); }
}
public List<Org> Orgs
{
get { return GetOrgsQuery().ToList(); }
}
public User User
{
get { return _user; }
set
{
_user = value;
_userRoleIds = _unitWork.Find<Relevance>(u => u.FirstId == _user.Id && u.Key == "UserRole").Select(u => u.SecondId).ToList();
}
}
public void Check(string userName, string password)
{
var _user = _unitWork.FindSingle<User>(u => u.Account == userName);
if (_user == null)
{
throw new Exception("用户帐号不存在");
}
_user.CheckPassword(password);
}
/// <summary>
/// 用户可访问的机构
/// </summary>
/// <returns>IQueryable&lt;Org&gt;.</returns>
public virtual IQueryable<Org> GetOrgsQuery()
{
var orgids = _unitWork.Find<Relevance>(
u =>
(u.FirstId == _user.Id && u.Key == "UserOrg") ||
(u.Key == "RoleOrg" && _userRoleIds.Contains(u.FirstId))).Select(u => u.SecondId);
return _unitWork.Find<Org>(u => orgids.Contains(u.Id));
}
/// <summary>
/// 获取用户可访问的资源
/// </summary>
/// <returns>IQueryable&lt;Resource&gt;.</returns>
public virtual IQueryable<Resource> GetResourcesQuery()
{
var resourceIds = _unitWork.Find<Relevance>(
u =>
(u.FirstId == _user.Id && u.Key == "UserResource") ||
(u.Key == "RoleResource" && _userRoleIds.Contains(u.FirstId))).Select(u => u.SecondId);
return _unitWork.Find<Resource>(u => resourceIds.Contains(u.Id));
}
/// <summary>
/// 模块菜单权限
/// </summary>
public virtual IQueryable<ModuleElement> GetModuleElementsQuery()
{
var elementIds = _unitWork.Find<Relevance>(
u =>
(u.FirstId == _user.Id && u.Key == "UserElement") ||
(u.Key == "RoleElement" && _userRoleIds.Contains(u.FirstId))).Select(u => u.SecondId);
return _unitWork.Find<ModuleElement>(u => elementIds.Contains(u.Id));
}
/// <summary>
/// 得出最终用户拥有的模块
/// </summary>
public virtual IQueryable<Module> GetModulesQuery()
{
var moduleIds = _unitWork.Find<Relevance>(
u =>
(u.FirstId == _user.Id && u.Key == "UserModule") ||
(u.Key == "RoleModule" && _userRoleIds.Contains(u.FirstId))).Select(u => u.SecondId);
return _unitWork.Find<Module>(u => moduleIds.Contains(u.Id)).OrderBy(u => u.SortNo);
}
//用户角色
public virtual IQueryable<Role> GetRolesQuery()
{
return _unitWork.Find<Role>(u => _userRoleIds.Contains(u.Id));
}
}
}

View File

@@ -1,58 +0,0 @@
// ***********************************************************************
// Assembly : OpenAuth.Domain
// Author : yubaolee
// Created : 04-21-2016
//
// Last Modified By : yubaolee
// Last Modified On : 04-21-2016
// Contact : Microsoft
// File: AuthenService.cs
// ***********************************************************************
using OpenAuth.Domain.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
namespace OpenAuth.Domain.Service
{
/// <summary>
/// 领域服务
/// <para>超级管理员权限</para>
/// </summary>
public class SystemAuthService : AuthoriseService
{
public SystemAuthService(IUnitWork unitWork):base(unitWork)
{
_user = new User { Account = "System", Id = string.Empty };
}
public override IQueryable<Org> GetOrgsQuery()
{
return _unitWork.Find<Org>(null);
}
public override IQueryable<Resource> GetResourcesQuery()
{
return _unitWork.Find<Resource>(null);
}
public override IQueryable<ModuleElement> GetModuleElementsQuery()
{
return _unitWork.Find<ModuleElement>(null);
}
public override IQueryable<Module> GetModulesQuery()
{
return _unitWork.Find<Module>(null);
}
public override IQueryable<Role> GetRolesQuery()
{
//用户角色
return _unitWork.Find<Role>(null);
}
}
}