mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-09-20 02:29:24 +08:00
完成模块分配按钮
This commit is contained in:
@@ -30,7 +30,7 @@ namespace OpenAuth.Mvc.Controllers
|
||||
var loginUser = SessionHelper.GetSessionUser<LoginUserVM>();
|
||||
if (loginUser == null)
|
||||
{
|
||||
Response.Redirect("/Login/Index");
|
||||
filterContext.Result = new RedirectResult("/Login/Index");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace OpenAuth.Mvc.Controllers
|
||||
&& !url.Contains("Git")
|
||||
&& !loginUser.Modules.Any(u => url.Contains(u.Url)))
|
||||
{
|
||||
Response.Redirect("/Error/NoAccess");
|
||||
filterContext.Result = new RedirectResult("/Login/Index");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
69
OpenAuth.Mvc/Controllers/ModuleElementManagerController.cs
Normal file
69
OpenAuth.Mvc/Controllers/ModuleElementManagerController.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : OpenAuth.Mvc
|
||||
// Author : Yubao Li
|
||||
// Created : 12-02-2015
|
||||
//
|
||||
// Last Modified By : Yubao Li
|
||||
// Last Modified On : 12-02-2015
|
||||
// ***********************************************************************
|
||||
// <copyright file="ModuleElementManagerController.cs" company="">
|
||||
// Copyright (c) . All rights reserved.
|
||||
// </copyright>
|
||||
// <summary>模块元素管理,无需权限控制</summary>
|
||||
// ***********************************************************************
|
||||
|
||||
using System;
|
||||
using System.Web.Mvc;
|
||||
using Infrastructure;
|
||||
using OpenAuth.App;
|
||||
using OpenAuth.Domain;
|
||||
using OpenAuth.Mvc.Models;
|
||||
|
||||
namespace OpenAuth.Mvc.Controllers
|
||||
{
|
||||
public class ModuleElementManagerController : Controller
|
||||
{
|
||||
private readonly BjuiResponse _bjuiResponse = new BjuiResponse();
|
||||
private ModuleElementManagerApp _app;
|
||||
|
||||
public ModuleElementManagerController()
|
||||
{
|
||||
_app = (ModuleElementManagerApp) DependencyResolver.Current.GetService(typeof (ModuleElementManagerApp));
|
||||
}
|
||||
|
||||
public ActionResult Index(int id = 0)
|
||||
{
|
||||
ViewBag.ModuleId = id;
|
||||
return View(_app.LoadByModuleId(id));
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public string AddOrEditButton(ModuleElement button)
|
||||
{
|
||||
try
|
||||
{
|
||||
_app.AddOrUpdate(button);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_bjuiResponse.statusCode = "300";
|
||||
_bjuiResponse.message = e.Message;
|
||||
}
|
||||
return JsonHelper.Instance.Serialize(_bjuiResponse);
|
||||
}
|
||||
|
||||
public string DelButton(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_app.Delete(id);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_bjuiResponse.statusCode = "300";
|
||||
_bjuiResponse.message = e.Message;
|
||||
}
|
||||
return JsonHelper.Instance.Serialize(_bjuiResponse);
|
||||
}
|
||||
}
|
||||
}
|
@@ -122,7 +122,7 @@ namespace OpenAuth.Mvc.Controllers
|
||||
return JsonHelper.Instance.Serialize(BjuiResponse);
|
||||
}
|
||||
|
||||
#region 命令操作
|
||||
#region 添加编辑模块
|
||||
public ActionResult Add(int id = 0)
|
||||
{
|
||||
return View(_app.Find(id));
|
||||
@@ -162,5 +162,6 @@ namespace OpenAuth.Mvc.Controllers
|
||||
return JsonHelper.Instance.Serialize(BjuiResponse);
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user