This commit is contained in:
yubaolee 2017-10-12 16:38:46 +08:00
parent 54eac35dbc
commit c617a3ecdb
20 changed files with 112 additions and 52 deletions

View File

@ -86,6 +86,9 @@
<Compile Include="Extention\WF_Runtime.cs" /> <Compile Include="Extention\WF_Runtime.cs" />
<Compile Include="Extention\WF_RuntimeInitModel.cs" /> <Compile Include="Extention\WF_RuntimeInitModel.cs" />
<Compile Include="Extention\WF_RuntimeModel.cs" /> <Compile Include="Extention\WF_RuntimeModel.cs" />
<Compile Include="Request\IdPageReq.cs" />
<Compile Include="Request\PageReq.cs" />
<Compile Include="Request\QueryUserListReq.cs" />
<Compile Include="WFFormService.cs" /> <Compile Include="WFFormService.cs" />
<Compile Include="WFProcessInstanceService.cs" /> <Compile Include="WFProcessInstanceService.cs" />
<Compile Include="WFSchemeService.cs" /> <Compile Include="WFSchemeService.cs" />
@ -128,7 +131,9 @@
<ItemGroup> <ItemGroup>
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<ItemGroup /> <ItemGroup>
<Folder Include="Response\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- 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. Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -0,0 +1,7 @@
namespace OpenAuth.App.Request
{
public class IdPageReq :PageReq
{
public string id { get; set; }
}
}

View File

@ -0,0 +1,16 @@
namespace OpenAuth.App.Request
{
public class PageReq
{
public int page { get; set; }
public int limit { get; set; }
public string key { get; set; }
public PageReq()
{
page = 1;
limit = 10;
}
}
}

View File

@ -0,0 +1,7 @@
namespace OpenAuth.App.Request
{
public class QueryUserListReq : PageReq
{
public string orgId { get; set; }
}
}

View File

@ -113,7 +113,7 @@ namespace OpenAuth.App.SSO
} }
/// <summary> /// <summary>
/// 되쌈왯 /// 되쌈왯
/// </summary> /// </summary>
/// <param name="appKey">应用程序key.</param> /// <param name="appKey">应用程序key.</param>
/// <param name="username">用户名</param> /// <param name="username">用户名</param>

View File

@ -5,7 +5,7 @@ using System.Web.Mvc;
namespace OpenAuth.App.SSO namespace OpenAuth.App.SSO
{ {
/// <summary> /// <summary>
/// 采用Attribute的方式验证登 /// 采用Attribute的方式验证登
/// <para>李玉宝新增于2016-11-09 10:08:10</para> /// <para>李玉宝新增于2016-11-09 10:08:10</para>
/// </summary> /// </summary>
public class SSOAuthAttribute : ActionFilterAttribute public class SSOAuthAttribute : ActionFilterAttribute

View File

@ -4,6 +4,7 @@ using OpenAuth.Domain.Interface;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using OpenAuth.App.Request;
namespace OpenAuth.App namespace OpenAuth.App
@ -43,20 +44,20 @@ namespace OpenAuth.App
/// <summary> /// <summary>
/// 加载一个部门及子部门全部用户 /// 加载一个部门及子部门全部用户
/// </summary> /// </summary>
public GridData Load(string orgId, int pageindex, int pagesize) public GridData Load(QueryUserListReq request)
{ {
if (pageindex < 1) pageindex = 1; //TODO:如果列表为空新增加一个用户后前端会传一个0过来奇怪 if (request.page < 1) request.page = 1; //TODO:如果列表为空新增加一个用户后前端会传一个0过来奇怪
IEnumerable<User> users; IEnumerable<User> users;
int records = 0; int records = 0;
if (orgId ==string.Empty) if (request.orgId ==string.Empty)
{ {
users = _repository.LoadUsers(pageindex, pagesize); users = _repository.LoadUsers(request.page, request.limit);
records = _repository.GetCount(); records = _repository.GetCount();
} }
else else
{ {
var ids = GetSubOrgIds(orgId); var ids = GetSubOrgIds(request.orgId);
users = _repository.LoadInOrgs(pageindex, pagesize, ids); users = _repository.LoadInOrgs(request.page, request.limit, ids);
records = _repository.GetUserCntInOrgs(ids); records = _repository.GetUserCntInOrgs(ids);
} }
var userviews = new List<UserView>(); var userviews = new List<UserView>();
@ -72,9 +73,9 @@ namespace OpenAuth.App
return new GridData return new GridData
{ {
count = records, count = records,
total = (int)Math.Ceiling((double)records / pagesize), total = (int)Math.Ceiling((double)records / request.limit),
data = userviews, data = userviews,
page = pageindex page = request.page
}; };
} }
@ -117,7 +118,7 @@ namespace OpenAuth.App
if (string.IsNullOrEmpty(view.OrganizationIds)) if (string.IsNullOrEmpty(view.OrganizationIds))
throw new Exception("请为用户分配机构"); throw new Exception("请为用户分配机构");
User user = view; User user = view;
if (user.Id == string.Empty) if (string.IsNullOrEmpty(view.Id))
{ {
if (_repository.IsExist(u => u.Account == view.Account)) if (_repository.IsExist(u => u.Account == view.Account))
{ {

View File

@ -34,13 +34,13 @@ namespace OpenAuth.Mvc.Controllers
foreach (var element in CurrentModule.Elements) foreach (var element in CurrentModule.Elements)
{ {
sb.Append("<button " sb.Append("<button "
+ " id='" + element.DomId + "' " + " data-type='" + element.DomId + "' "
+ " class='btn btn-sm " + element.Class + "' " + " class='layui-btn " + element.Class + "' "
+ " onclick='" + element.Script + "' " + element.Attr + element.Attr
+ ">"); + ">");
if (!string.IsNullOrEmpty(element.Icon)) if (!string.IsNullOrEmpty(element.Icon))
{ {
sb.Append("<i class='ace-icon fa fa-" + element.Icon + "'></i>"); sb.Append("<i class='layui-icon'>" + element.Icon + "</i>");
} }
sb.Append(element.Name + "</button>"); sb.Append(element.Name + "</button>");
} }

View File

@ -31,7 +31,7 @@ namespace OpenAuth.Mvc.Controllers
} }
else else
{ {
resp.Message = "登失败"; resp.Message = "登失败";
} }
} }
catch (Exception e) catch (Exception e)
@ -43,7 +43,7 @@ namespace OpenAuth.Mvc.Controllers
} }
/// <summary> /// <summary>
/// 开发者登 /// 开发者登
/// </summary> /// </summary>
public ActionResult LoginByDev() public ActionResult LoginByDev()
{ {

View File

@ -1,8 +1,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Web.Http;
using System.Web.Mvc; using System.Web.Mvc;
using Infrastructure; using Infrastructure;
using OpenAuth.App; using OpenAuth.App;
using OpenAuth.App.Request;
using OpenAuth.App.ViewModel; using OpenAuth.App.ViewModel;
using OpenAuth.Mvc.Models; using OpenAuth.Mvc.Models;
@ -21,7 +23,7 @@ namespace OpenAuth.Mvc.Controllers
} }
//添加或修改组织 //添加或修改组织
[HttpPost] [System.Web.Mvc.HttpPost]
public string AddOrUpdate(UserView view) public string AddOrUpdate(UserView view)
{ {
try try
@ -40,12 +42,12 @@ namespace OpenAuth.Mvc.Controllers
/// <summary> /// <summary>
/// 加载组织下面的所有用户 /// 加载组织下面的所有用户
/// </summary> /// </summary>
public string Load(string orgId, int page = 1, int limit = 30) public string Load([FromUri]QueryUserListReq request)
{ {
return JsonHelper.Instance.Serialize(App.Load(orgId, page, limit)); return JsonHelper.Instance.Serialize(App.Load(request));
} }
[HttpPost] [System.Web.Mvc.HttpPost]
public string Delete(string[] ids) public string Delete(string[] ids)
{ {
try try
@ -69,7 +71,7 @@ namespace OpenAuth.Mvc.Controllers
/// </summary> /// </summary>
public string GetAccessedUsers() public string GetAccessedUsers()
{ {
IEnumerable<UserView> users = App.Load(string.Empty, 1, 10).data; IEnumerable<UserView> users = App.Load(new QueryUserListReq()).data;
var result = new Dictionary<string , object>(); var result = new Dictionary<string , object>();
foreach (var user in users) foreach (var user in users)
{ {
@ -77,14 +79,14 @@ namespace OpenAuth.Mvc.Controllers
{ {
Account = user.Account, Account = user.Account,
RealName = user.Name, RealName = user.Name,
id = user.Id.ToString(), id = user.Id,
text = user.Name, text = user.Name,
value = user.Account, value = user.Account,
parentId = "0", parentId = "0",
showcheck = true, showcheck = true,
img = "fa fa-user", img = "fa fa-user",
}; };
result.Add(user.Id.ToString(), item); result.Add(user.Id, item);
} }
return JsonHelper.Instance.Serialize(result); return JsonHelper.Instance.Serialize(result);

View File

@ -7,13 +7,13 @@ using OpenAuth.App.ViewModel;
namespace OpenAuth.Mvc.Controllers namespace OpenAuth.Mvc.Controllers
{ {
/// <summary> /// <summary>
/// 获取登用户的全部信息 /// 获取登用户的全部信息
/// </summary> /// </summary>
public class UserSessionController : BaseController public class UserSessionController : BaseController
{ {
UserWithAccessedCtrls user = AuthUtil.GetCurrentUser(); UserWithAccessedCtrls user = AuthUtil.GetCurrentUser();
/// <summary> /// <summary>
/// 获取登用户可访问的所有模块,及模块的操作菜单 /// 获取登用户可访问的所有模块,及模块的操作菜单
/// </summary> /// </summary>
public string GetModulesTree() public string GetModulesTree()
{ {
@ -22,7 +22,7 @@ namespace OpenAuth.Mvc.Controllers
} }
/// <summary> /// <summary>
/// 获取登用户可访问的所有部门 /// 获取登用户可访问的所有部门
/// </summary> /// </summary>
public string GetOrgs() public string GetOrgs()
{ {

View File

@ -375,6 +375,7 @@
<Content Include="Views\Shared\_Form.cshtml" /> <Content Include="Views\Shared\_Form.cshtml" />
<Content Include="Views\Home\Main.cshtml" /> <Content Include="Views\Home\Main.cshtml" />
<Content Include="Views\Shared\_Layout.cshtml" /> <Content Include="Views\Shared\_Layout.cshtml" />
<Content Include="Views\Home\MenuHeader.cshtml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="App_Data\" /> <Folder Include="App_Data\" />

View File

@ -74,7 +74,7 @@
<blockquote class="layui-elem-quote explain"> <blockquote class="layui-elem-quote explain">
<p>官方博客:<a href="http://www.cnblogs.com/yubaolee/">http://www.cnblogs.com/yubaolee/</a> </p> <p>官方博客:<a href="http://www.cnblogs.com/yubaolee/">http://www.cnblogs.com/yubaolee/</a> </p>
<p> <p>
admin/test两个账号只分配了部分模块/部门,系统完整模块/部门情况请直接在登录界面点击“以开发者账号登 admin/test两个账号只分配了部分模块/部门,系统完整模块/部门情况请直接在登录界面点击“以开发者账号登
</p> </p>
<p> <p>
<span style="color: #1E9FFF;">郑重提示为安全起见关闭了所有修改请求如想体验完整功能可搭建本地环境并将version置为空字符串</span> <span style="color: #1E9FFF;">郑重提示为安全起见关闭了所有修改请求如想体验完整功能可搭建本地环境并将version置为空字符串</span>

View File

@ -0,0 +1,8 @@

@{
Layout = null;
}
@Html.Raw(ViewBag.Buttons)

View File

@ -10,10 +10,11 @@
</div> </div>
<button class="layui-btn" data-type="search">搜索</button> <button class="layui-btn" data-type="search">搜索</button>
</div> </div>
<button class="layui-btn " data-type="refresh">刷新</button> @Html.Action("MenuHeader", "Home")
@*<button class="layui-btn " data-type="refresh">刷新</button>
<button class="layui-btn " data-type="addData">添加用户</button> <button class="layui-btn " data-type="addData">添加用户</button>
<button class="layui-btn layui-btn-danger" data-type="del">批量删除</button> <button class="layui-btn layui-btn-danger" data-type="del">批量删除</button>
<button class="layui-btn layui-btn-danger" data-type="assignModule">为用户分配模块/菜单</button> <button class="layui-btn layui-btn-danger" data-type="assignModule">为用户分配模块/菜单</button>*@
</blockquote> </blockquote>
<div style="display: flex;"> <div style="display: flex;">
@ -36,8 +37,6 @@
</div> </div>
<script type="text/html" id="barList"> <script type="text/html" id="barList">
<a class="layui-btn layui-btn-primary layui-btn-mini" lay-event="detail">查看</a> <a class="layui-btn layui-btn-primary layui-btn-mini" lay-event="detail">查看</a>
<a class="layui-btn layui-btn-mini" lay-event="edit">编辑</a>
<a class="layui-btn layui-btn-danger layui-btn-mini" lay-event="del">删除</a>
</script> </script>
<!--用户添加/编辑窗口--> <!--用户添加/编辑窗口-->

View File

@ -95,7 +95,7 @@ layui.config({
add: function() { //弹出添加 add: function() { //弹出添加
update = false; update = false;
show({ show({
Id: '00000000-0000-0000-0000-000000000000' Id: ''
}); });
}, },
update: function(data) { //弹出编辑框 update: function(data) { //弹出编辑框
@ -110,34 +110,41 @@ layui.config({
var data = obj.data; var data = obj.data;
if (obj.event === 'detail') { //查看 if (obj.event === 'detail') { //查看
layer.msg('ID' + data.Id + ' 的查看操作'); layer.msg('ID' + data.Id + ' 的查看操作');
} else if (obj.event === 'del') { //删除 }
openauth.del("/UserManager/Delete", data.Id, obj.del);
} else if (obj.event === 'edit') { //编辑
editDlg.update(data);
}
}); });
//监听页面主按钮操作 //监听页面主按钮操作
var active = { var active = {
del: function () { //批量删除 btnDel: function () { //批量删除
var checkStatus = table.checkStatus('mainList') var checkStatus = table.checkStatus('mainList')
, data = checkStatus.data; , data = checkStatus.data;
openauth.del("/UserManager/Delete", data.map(function (e) { return e.Id; }), mainList); openauth.del("/UserManager/Delete",
data.map(function (e) { return e.Id; }),
mainList);
} }
, addData: function () { //添加 , btnAdd: function () { //添加
editDlg.add(); editDlg.add();
} }
, btnEdit: function () { //编辑
var checkStatus = table.checkStatus('mainList')
, data = checkStatus.data;
if (data.length != 1) {
layer.msg("请选择编辑的行,且同时只能编辑一行");
return;
}
editDlg.update(data[0]);
}
, search: function () { //搜索 , search: function () { //搜索
mainList({ key: $('#key').val() }); mainList({ key: $('#key').val() });
} }
, refresh: function() { , btnRefresh: function() {
mainList(); mainList();
} }
, btnAccessModule: function () {
, assignModule: function () {
var index = layer.open({ var index = layer.open({
title: "分配模块菜单", title: "为用户分配模块",
type: 2, type: 2,
content: "newsAdd.html", content: "newsAdd.html",
success: function(layero, index) { success: function(layero, index) {

View File

@ -1,6 +1,7 @@
using System; using System;
using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenAuth.App; using OpenAuth.App;
using OpenAuth.App.Request;
using OpenAuth.App.ViewModel; using OpenAuth.App.ViewModel;
namespace OpenAuth.UnitTest namespace OpenAuth.UnitTest
@ -45,7 +46,13 @@ namespace OpenAuth.UnitTest
[TestMethod] [TestMethod]
public void GetUser() public void GetUser()
{ {
var users = _app.Load("990cb229-cc18-41f3-8e2b-13f0f0110798", 2, 30); var request = new QueryUserListReq
{
orgId = "990cb229-cc18-41f3-8e2b-13f0f0110798",
page = 2,
limit = 30
};
var users = _app.Load(request);
Console.WriteLine(users.total); Console.WriteLine(users.total);
} }

View File

@ -8,7 +8,7 @@
<link href="/Areas/SSO/Content/bootstrap.min.css" rel="stylesheet"> <link href="/Areas/SSO/Content/bootstrap.min.css" rel="stylesheet">
<link href="/Areas/SSO/Content/Site.css" rel="stylesheet"> <link href="/Areas/SSO/Content/Site.css" rel="stylesheet">
<style id="igtranslator-color" type="text/css"></style> <style id="igtranslator-color" type="text/css"></style>
<title>OpenAuth.net统一登授权中心</title> <title>OpenAuth.net统一登授权中心</title>
</head> </head>
<html> <html>
<body> <body>

View File

@ -17,7 +17,7 @@
<div class="media"> <div class="media">
<div class="media-body"> <div class="media-body">
<h4 class="media-heading">@ViewBag.CurrentUser.User.Account ,您好!</h4> <h4 class="media-heading">@ViewBag.CurrentUser.User.Account ,您好!</h4>
<p>因为使用了SSO所以您可以直接进入OpenAuth.Net而不用重复登</p> <p>因为使用了SSO所以您可以直接进入OpenAuth.Net而不用重复登</p>
<p> <p>
<a href="/Home/Admin" class="btn btn-primary">直接进入OpenAuth.Net</a> <a href="/Home/Admin" class="btn btn-primary">直接进入OpenAuth.Net</a>
<a href="/login/logout" class="btn btn-danger">注销</a> <a href="/login/logout" class="btn btn-danger">注销</a>

View File

@ -4,7 +4,7 @@
ViewBag.Title = "title"; ViewBag.Title = "title";
} }
<h2>OpenAuth.net测试站点登</h2> <h2>OpenAuth.net测试站点登</h2>
@if (Model != null && !Model.Success) @if (Model != null && !Model.Success)
@ -34,8 +34,8 @@
<label class="checkbox"> <label class="checkbox">
<input type="checkbox"> Remember me <input type="checkbox"> Remember me
</label> </label>
<button type="submit" class="btn btn-primary">登</button> <button type="submit" class="btn btn-primary">登</button>
<a href="http://localhost:52789/SSO/Login?appkey=@ViewBag.AppKey">或者使用OpenAuth.net第三方登功能</a> <a href="http://localhost:52789/SSO/Login?appkey=@ViewBag.AppKey">或者使用OpenAuth.net第三方登功能</a>
</div> </div>
</div> </div>
</form> </form>