mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-09-21 02:57:54 +08:00
这是有史以来最艰难的一次提交,不生则死!
This commit is contained in:
@@ -1,81 +0,0 @@
|
||||
using Infrastructure;
|
||||
using OpenAuth.App;
|
||||
using System;
|
||||
using System.Web.Http;
|
||||
using System.Web.Mvc;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using OpenAuth.Mvc.Models;
|
||||
|
||||
namespace OpenAuth.Mvc.Controllers
|
||||
{
|
||||
public class RoleManagerController : BaseController
|
||||
{
|
||||
public RoleManagerApp App { get; set; }
|
||||
|
||||
//
|
||||
// GET: /RoleManager/
|
||||
[Authenticate]
|
||||
public ActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
//添加或修改角色
|
||||
[System.Web.Mvc.HttpPost]
|
||||
public string Add([FromBody]JObject obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
App.AddOrUpdate(obj);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Result.Status = false;
|
||||
Result.Message = ex.Message;
|
||||
}
|
||||
return JsonHelper.Instance.Serialize(Result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载角色下面的所有用户
|
||||
/// </summary>
|
||||
public string Load(string orgId, int pageCurrent = 1, int pageSize = 30)
|
||||
{
|
||||
return JsonHelper.Instance.Serialize(App.Load(orgId, pageCurrent, pageSize));
|
||||
}
|
||||
|
||||
[System.Web.Mvc.HttpPost]
|
||||
public string Delete(string[] ids)
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (var obj in ids)
|
||||
{
|
||||
App.Delete(obj);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Result.Status = false;
|
||||
Result.Message = e.Message;
|
||||
}
|
||||
|
||||
return JsonHelper.Instance.Serialize(Result);
|
||||
}
|
||||
|
||||
#region 为用户设置角色界面
|
||||
public ActionResult LookupMulti(string firstId, string key)
|
||||
{
|
||||
ViewBag.FirstId = firstId;
|
||||
ViewBag.ModuleType = key;
|
||||
return View();
|
||||
}
|
||||
|
||||
public string LoadForOrgAndUser(string orgId, string userId)
|
||||
{
|
||||
return JsonHelper.Instance.Serialize(App.LoadForOrgAndUser(orgId, userId));
|
||||
}
|
||||
|
||||
#endregion 为用户设置角色界面
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user