diff --git a/OpenAuth.Mvc/Controllers/BaseController.cs b/OpenAuth.Mvc/Controllers/BaseController.cs
index db161dac..e1b87e98 100644
--- a/OpenAuth.Mvc/Controllers/BaseController.cs
+++ b/OpenAuth.Mvc/Controllers/BaseController.cs
@@ -12,29 +12,42 @@
// 基础控制器,设置权限
// ***********************************************************************
-using System.Web.Mvc;
+using System;
+using System.Linq;
using Infrastructure.Helper;
using OpenAuth.App.ViewModel;
-using OpenAuth.Domain;
using OpenAuth.Mvc.Models;
+using System.Web.Mvc;
namespace OpenAuth.Mvc.Controllers
{
- public class BaseController : Controller
- {
+ public class BaseController : Controller
+ {
protected BjuiResponse BjuiResponse = new BjuiResponse();
-
- protected override void OnActionExecuting(ActionExecutingContext filterContext)
- {
- base.OnActionExecuting(filterContext);
-
- //#region 当Session过期自动跳出登录画面
- if (SessionHelper.GetSessionUser() == null)
+ protected override void OnActionExecuting(ActionExecutingContext filterContext)
+ {
+ var loginUser = SessionHelper.GetSessionUser();
+ if (loginUser == null)
{
Response.Redirect("/Login/Index");
+ return;
}
- //#endregion
- }
- }
+
+ if (Request.Url != null)
+ {
+ string url = Request.Url.LocalPath;
+ if(url !="/"
+ && !url.Contains("Main")
+ && !url.Contains("Error")
+ && !url.Contains("Git")
+ && !loginUser.Modules.Any(u => url.Contains(u.Url)))
+ {
+ Response.Redirect("/Error/NoAccess");
+ return;
+ }
+ }
+ base.OnActionExecuting(filterContext);
+ }
+ }
}
\ No newline at end of file
diff --git a/OpenAuth.Mvc/Controllers/ErrorController.cs b/OpenAuth.Mvc/Controllers/ErrorController.cs
new file mode 100644
index 00000000..4433cc90
--- /dev/null
+++ b/OpenAuth.Mvc/Controllers/ErrorController.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.Mvc;
+
+namespace OpenAuth.Mvc.Controllers
+{
+ public class ErrorController : Controller
+ {
+ // GET: Error
+ public ActionResult NoAccess()
+ {
+ return View();
+ }
+ }
+}
\ No newline at end of file
diff --git a/OpenAuth.Mvc/Controllers/OrgManagerController.cs b/OpenAuth.Mvc/Controllers/OrgManagerController.cs
index 295eb6bd..a0e79b49 100644
--- a/OpenAuth.Mvc/Controllers/OrgManagerController.cs
+++ b/OpenAuth.Mvc/Controllers/OrgManagerController.cs
@@ -82,7 +82,7 @@ namespace OpenAuth.Mvc.Controllers
{
Id = 0,
ParentId = -1,
- Name = "全部机构",
+ Name = "根结点",
CascadeId = "0"
});
return JsonHelper.Instance.Serialize(orgs);
diff --git a/OpenAuth.Mvc/OpenAuth.Mvc.csproj b/OpenAuth.Mvc/OpenAuth.Mvc.csproj
index 4d44a962..074fb901 100644
--- a/OpenAuth.Mvc/OpenAuth.Mvc.csproj
+++ b/OpenAuth.Mvc/OpenAuth.Mvc.csproj
@@ -125,6 +125,7 @@
+
@@ -552,6 +553,7 @@
+
diff --git a/OpenAuth.Mvc/Views/Error/NoAccess.cshtml b/OpenAuth.Mvc/Views/Error/NoAccess.cshtml
new file mode 100644
index 00000000..3908a576
--- /dev/null
+++ b/OpenAuth.Mvc/Views/Error/NoAccess.cshtml
@@ -0,0 +1,38 @@
+@{
+ Layout = null;
+}
+
+
+
+
+
+
+
+
+
OpenAuth.Net/GIT
+
+
+
+
+
+
+
+
+
diff --git a/OpenAuth.Mvc/Views/Home/Main.cshtml b/OpenAuth.Mvc/Views/Home/Main.cshtml
index 1ecaa806..05e6782c 100644
--- a/OpenAuth.Mvc/Views/Home/Main.cshtml
+++ b/OpenAuth.Mvc/Views/Home/Main.cshtml
@@ -26,9 +26,6 @@