mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-09-18 17:48:01 +08:00
增加流程状态转换列表
This commit is contained in:
38
OpenAuth.App/ApplyTransitionHistoryApp.cs
Normal file
38
OpenAuth.App/ApplyTransitionHistoryApp.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using OpenAuth.Domain;
|
||||
using OpenAuth.Domain.Interface;
|
||||
|
||||
namespace OpenAuth.App
|
||||
{
|
||||
public class ApplyTransitionHistoryApp
|
||||
{
|
||||
private IRepository<ApplyTransitionHistory> _repository;
|
||||
|
||||
public ApplyTransitionHistoryApp(IRepository<ApplyTransitionHistory> repository)
|
||||
{
|
||||
_repository = repository;
|
||||
}
|
||||
|
||||
public ApplyTransitionHistory Get(Guid processId, string currentstate, string nextState)
|
||||
{
|
||||
return _repository.FindSingle(h => h.ApplyId == processId && !h.TransitionTime.HasValue &&
|
||||
h.InitialState == currentstate && h.DestinationState == nextState);
|
||||
}
|
||||
|
||||
public void Add(ApplyTransitionHistory historyItem)
|
||||
{
|
||||
_repository.Add(historyItem);
|
||||
}
|
||||
|
||||
public void Update(ApplyTransitionHistory historyItem)
|
||||
{
|
||||
_repository.Update(historyItem);
|
||||
}
|
||||
|
||||
public void DeleteByProcess(Guid processId)
|
||||
{
|
||||
_repository.Delete(dth =>
|
||||
dth.ApplyId == processId && !dth.TransitionTime.HasValue);
|
||||
}
|
||||
}
|
||||
}
|
@@ -80,8 +80,10 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ApplyTransitionHistoryApp.cs" />
|
||||
<Compile Include="CategoryManagerApp.cs" />
|
||||
<Compile Include="AuthorizeApp.cs" />
|
||||
<Compile Include="WorkflowInboxApp.cs" />
|
||||
<Compile Include="ModuleElementManagerApp.cs" />
|
||||
<Compile Include="ModuleManagerApp.cs" />
|
||||
<Compile Include="ResourceManagerApp.cs" />
|
||||
|
@@ -147,5 +147,14 @@ namespace OpenAuth.App
|
||||
{
|
||||
_relevanceRepository.DeleteBy("UserRole", roleids.ToLookup(roleId => userId));
|
||||
}
|
||||
|
||||
public List<Guid> GetUsersInRole(string ruleName)
|
||||
{
|
||||
var role = _repository.FindSingle(u => u.Name == ruleName);
|
||||
if (role == null) return null;
|
||||
|
||||
return _relevanceRepository.Find(u => u.Key == "UserRole"
|
||||
&& u.SecondId == role.Id).Select(u => u.FirstId).ToList();
|
||||
}
|
||||
}
|
||||
}
|
@@ -143,5 +143,9 @@ namespace OpenAuth.App
|
||||
_relevanceRepository.AddRelevance("UserOrg", orgIds.ToLookup(u => user.Id));
|
||||
}
|
||||
|
||||
public IEnumerable<User> GetUsers(IEnumerable<Guid> userids)
|
||||
{
|
||||
return _repository.Find(u => userids.Contains(u.Id));
|
||||
}
|
||||
}
|
||||
}
|
28
OpenAuth.App/WorkflowInboxApp.cs
Normal file
28
OpenAuth.App/WorkflowInboxApp.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using OpenAuth.App.ViewModel;
|
||||
using OpenAuth.Domain;
|
||||
using OpenAuth.Domain.Interface;
|
||||
|
||||
namespace OpenAuth.App
|
||||
{
|
||||
public class WorkflowInboxApp
|
||||
{
|
||||
private IRepository<WorkflowInbox> _repository;
|
||||
|
||||
public WorkflowInboxApp(IRepository<WorkflowInbox> repository)
|
||||
{
|
||||
_repository = repository;
|
||||
}
|
||||
|
||||
|
||||
public void DeleteAllByProcess(Guid processId)
|
||||
{
|
||||
_repository.Delete(u =>u.ProcessId == processId);
|
||||
}
|
||||
|
||||
public void Add(WorkflowInbox newInboxItem)
|
||||
{
|
||||
_repository.Add(newInboxItem);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user