mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-07-15 14:04:41 +08:00
ru
This commit is contained in:
parent
2c2e5cd179
commit
5e6445cbc9
@ -2,15 +2,12 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenAuth.Repository.Domain;
|
using OpenAuth.Repository.Domain;
|
||||||
using OpenAuth.Repository.Interface;
|
|
||||||
|
|
||||||
namespace OpenAuth.App
|
namespace OpenAuth.App
|
||||||
{
|
{
|
||||||
public class RevelanceManagerApp
|
public class RevelanceManagerApp :BaseApp<Relevance>
|
||||||
{
|
{
|
||||||
|
|
||||||
public IUnitWork _unitWork { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 添加关联
|
/// 添加关联
|
||||||
/// <para>比如给用户分配资源,那么firstId就是用户ID,secIds就是资源ID列表</para>
|
/// <para>比如给用户分配资源,那么firstId就是用户ID,secIds就是资源ID列表</para>
|
||||||
@ -24,7 +21,7 @@ namespace OpenAuth.App
|
|||||||
public void Assign(string key, ILookup<string, string> idMaps)
|
public void Assign(string key, ILookup<string, string> idMaps)
|
||||||
{
|
{
|
||||||
DeleteBy(key, idMaps);
|
DeleteBy(key, idMaps);
|
||||||
_unitWork.BatchAdd((from sameVals in idMaps
|
UnitWork.BatchAdd((from sameVals in idMaps
|
||||||
from value in sameVals
|
from value in sameVals
|
||||||
select new Relevance
|
select new Relevance
|
||||||
{
|
{
|
||||||
@ -33,7 +30,7 @@ namespace OpenAuth.App
|
|||||||
SecondId = value,
|
SecondId = value,
|
||||||
OperateTime = DateTime.Now
|
OperateTime = DateTime.Now
|
||||||
}).ToArray());
|
}).ToArray());
|
||||||
_unitWork.Save();
|
UnitWork.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -49,7 +46,7 @@ namespace OpenAuth.App
|
|||||||
{
|
{
|
||||||
foreach (var value in sameVals)
|
foreach (var value in sameVals)
|
||||||
{
|
{
|
||||||
_unitWork.Delete<Relevance>(u => u.Key == key && u.FirstId == sameVals.Key && u.SecondId == value);
|
Repository.Delete(u => u.Key == key && u.FirstId == sameVals.Key && u.SecondId == value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -67,7 +64,7 @@ namespace OpenAuth.App
|
|||||||
|
|
||||||
public void DeleteBy(string key, params string[] firstIds)
|
public void DeleteBy(string key, params string[] firstIds)
|
||||||
{
|
{
|
||||||
_unitWork.Delete<Relevance>(u => firstIds.Contains(u.FirstId) && u.Key == key);
|
Repository.Delete(u => firstIds.Contains(u.FirstId) && u.Key == key);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -78,7 +75,7 @@ namespace OpenAuth.App
|
|||||||
public void AddRelevance(string key, ILookup<string, string> idMaps)
|
public void AddRelevance(string key, ILookup<string, string> idMaps)
|
||||||
{
|
{
|
||||||
DeleteBy(key, idMaps);
|
DeleteBy(key, idMaps);
|
||||||
_unitWork.BatchAdd<Relevance>((from sameVals in idMaps
|
UnitWork.BatchAdd<Relevance>((from sameVals in idMaps
|
||||||
from value in sameVals
|
from value in sameVals
|
||||||
select new Relevance
|
select new Relevance
|
||||||
{
|
{
|
||||||
@ -87,7 +84,7 @@ namespace OpenAuth.App
|
|||||||
SecondId = value,
|
SecondId = value,
|
||||||
OperateTime = DateTime.Now
|
OperateTime = DateTime.Now
|
||||||
}).ToArray());
|
}).ToArray());
|
||||||
_unitWork.Save();
|
UnitWork.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -101,12 +98,12 @@ namespace OpenAuth.App
|
|||||||
{
|
{
|
||||||
if (returnSecondIds)
|
if (returnSecondIds)
|
||||||
{
|
{
|
||||||
return _unitWork.Find<Relevance>(u => u.Key == key
|
return Repository.Find(u => u.Key == key
|
||||||
&& ids.Contains(u.FirstId)).Select(u => u.SecondId).ToList();
|
&& ids.Contains(u.FirstId)).Select(u => u.SecondId).ToList();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return _unitWork.Find<Relevance>(u => u.Key == key
|
return Repository.Find(u => u.Key == key
|
||||||
&& ids.Contains(u.SecondId)).Select(u => u.FirstId).ToList();
|
&& ids.Contains(u.SecondId)).Select(u => u.FirstId).ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,8 +26,8 @@ namespace OpenAuth.App
|
|||||||
int records = 0;
|
int records = 0;
|
||||||
if (string.IsNullOrEmpty(request.orgId))
|
if (string.IsNullOrEmpty(request.orgId))
|
||||||
{
|
{
|
||||||
users = UnitWork.Find<User>(null).OrderBy(u => u.Id).Skip((request.page - 1) * request.limit).Take(request.limit);
|
users = Repository.Find(null).OrderBy(u => u.Id).Skip((request.page - 1) * request.limit).Take(request.limit);
|
||||||
records = UnitWork.GetCount<User>();
|
records = Repository.GetCount();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -37,7 +37,7 @@ namespace OpenAuth.App
|
|||||||
.OrderBy(u => u.Name)
|
.OrderBy(u => u.Name)
|
||||||
.Skip((request.page - 1) * request.limit)
|
.Skip((request.page - 1) * request.limit)
|
||||||
.Take(request.limit);
|
.Take(request.limit);
|
||||||
records = UnitWork.GetCount<User>();
|
records = Repository.GetCount(u => userIds.Contains(u.Id));
|
||||||
}
|
}
|
||||||
|
|
||||||
var userviews = new List<UserView>();
|
var userviews = new List<UserView>();
|
||||||
|
@ -357,7 +357,6 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="Areas\FlowManage\Models\" />
|
<Folder Include="Areas\FlowManage\Models\" />
|
||||||
<Folder Include="Areas\FlowManage\Views\Shared\" />
|
<Folder Include="Areas\FlowManage\Views\Shared\" />
|
||||||
<Folder Include="Views\Base\" />
|
|
||||||
<Folder Include="Views\UserSession\" />
|
<Folder Include="Views\UserSession\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -46,8 +46,11 @@ layui.config({
|
|||||||
};
|
};
|
||||||
var load = function () {
|
var load = function () {
|
||||||
$.getJSON(url, function (json) {
|
$.getJSON(url, function (json) {
|
||||||
zTreeObj = $.fn.zTree.init($("#tree"), setting, json);
|
zTreeObj = $.fn.zTree.init($("#tree"), setting);
|
||||||
mainList({ orgId: json[0].Id });
|
var newNode = { Name: "根节点", Id: null, ParentId: "" };
|
||||||
|
json.push(newNode);
|
||||||
|
zTreeObj.addNodes(null, json);
|
||||||
|
mainList({ orgId: "" });
|
||||||
zTreeObj.expandAll(true);
|
zTreeObj.expandAll(true);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -35,7 +35,7 @@ layui.config({
|
|||||||
enable: true,
|
enable: true,
|
||||||
idKey: 'Id',
|
idKey: 'Id',
|
||||||
pIdKey: 'ParentId',
|
pIdKey: 'ParentId',
|
||||||
rootPId: 'null'
|
rootPId: ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
callback: {
|
callback: {
|
||||||
@ -46,8 +46,11 @@ layui.config({
|
|||||||
};
|
};
|
||||||
var load = function () {
|
var load = function () {
|
||||||
$.getJSON(url, function (json) {
|
$.getJSON(url, function (json) {
|
||||||
zTreeObj = $.fn.zTree.init($("#tree"), setting, json);
|
zTreeObj = $.fn.zTree.init($("#tree"), setting);
|
||||||
mainList({ orgId: json[0].Id });
|
var newNode = { Name: "根节点", Id: null,ParentId:"" };
|
||||||
|
json.push(newNode);
|
||||||
|
zTreeObj.addNodes(null, json);
|
||||||
|
mainList({ orgId: "" });
|
||||||
zTreeObj.expandAll(true);
|
zTreeObj.expandAll(true);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -48,7 +48,7 @@ namespace OpenAuth.UnitTest
|
|||||||
{
|
{
|
||||||
var request = new QueryUserListReq
|
var request = new QueryUserListReq
|
||||||
{
|
{
|
||||||
orgId = "543a9fcf-4770-4fd9-865f-030e562be238",
|
orgId = "",
|
||||||
page = 1,
|
page = 1,
|
||||||
limit = 30
|
limit = 30
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user