mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2026-06-26 22:33:09 +08:00
ru
This commit is contained in:
@@ -1,28 +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
|
||||
{
|
||||
public IUnitWork _unitWork { get; set; }
|
||||
|
||||
public AuthoriseService Create(string loginuser)
|
||||
{
|
||||
if (loginuser == "System")
|
||||
{
|
||||
return new SystemAuthService();
|
||||
}
|
||||
else
|
||||
{
|
||||
return new AuthoriseService()
|
||||
{
|
||||
_unitWork = _unitWork,
|
||||
User = _unitWork.FindSingle<User>(u =>u.Account == loginuser)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
using System.Linq;
|
||||
using Infrastructure;
|
||||
using OpenAuth.App.ViewModel;
|
||||
using OpenAuth.Domain;
|
||||
using OpenAuth.Domain.Interface;
|
||||
using OpenAuth.Domain.Service;
|
||||
|
||||
namespace OpenAuth.App
|
||||
@@ -11,16 +13,26 @@ namespace OpenAuth.App
|
||||
/// </summary>
|
||||
public class AuthorizeApp
|
||||
{
|
||||
private readonly AuthoriseFactory _factory;
|
||||
public SystemAuthService AuthService { get; set; }
|
||||
public AuthoriseService AuthoriseService { get; set; }
|
||||
|
||||
public AuthorizeApp(AuthoriseFactory service)
|
||||
public IUnitWork _unitWork { get; set; }
|
||||
public AuthoriseService Create(string loginuser)
|
||||
{
|
||||
_factory = service;
|
||||
if (loginuser == "System")
|
||||
{
|
||||
return AuthService;
|
||||
}
|
||||
else
|
||||
{
|
||||
AuthoriseService.User = _unitWork.FindSingle<User>(u => u.Account == loginuser);
|
||||
return AuthoriseService;
|
||||
}
|
||||
}
|
||||
|
||||
public UserWithAccessedCtrls GetAccessedControls(string username)
|
||||
{
|
||||
var service = _factory.Create(username);
|
||||
var service = Create(username);
|
||||
var user = new UserWithAccessedCtrls
|
||||
{
|
||||
User = service.User,
|
||||
|
||||
@@ -80,7 +80,6 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AuthoriseFactory.cs" />
|
||||
<Compile Include="AuthoriseService.cs" />
|
||||
<Compile Include="CategoryManagerApp.cs" />
|
||||
<Compile Include="AuthorizeApp.cs" />
|
||||
|
||||
Reference in New Issue
Block a user