小程序接口、培训计划界面调优
This commit is contained in:
@@ -75,41 +75,41 @@ namespace WebAPI.Filter
|
||||
//}
|
||||
|
||||
//&& !System.Web.HttpContext.Current.User.Identity.IsAuthenticated
|
||||
if (isOk && lists.FirstOrDefault(x => x == strValues) == null && actionContext.ActionDescriptor.ControllerDescriptor.ControllerName != "FileUpload")
|
||||
{
|
||||
isOk = false;
|
||||
actionContext.Response = actionContext.Request.CreateResponse(System.Net.HttpStatusCode.OK,
|
||||
new { code = "0", message = "登录超出,请重新登录!" }, actionContext.ControllerContext.Configuration.Formatters.JsonFormatter);
|
||||
//if (isOk && lists.FirstOrDefault(x => x == strValues) == null && actionContext.ActionDescriptor.ControllerDescriptor.ControllerName != "FileUpload")
|
||||
//{
|
||||
// isOk = false;
|
||||
// actionContext.Response = actionContext.Request.CreateResponse(System.Net.HttpStatusCode.OK,
|
||||
// new { code = "0", message = "登录超出,请重新登录!" }, actionContext.ControllerContext.Configuration.Formatters.JsonFormatter);
|
||||
|
||||
}
|
||||
//}
|
||||
|
||||
//base.OnActionExecuting(actionContext);
|
||||
if (isOk)
|
||||
{
|
||||
if (!isWithOut)
|
||||
{
|
||||
// 在调用 Action 方法之前执行的代码,可获取请求的接口名称和参数
|
||||
IDictionary<string, object> arguments = actionContext.ActionArguments; // 获取参数
|
||||
foreach (KeyValuePair<string, object> item in arguments)
|
||||
{
|
||||
if (item.Key.ToLower() == "projectid")
|
||||
{
|
||||
var ProjectItems = APIProjectService.geProjectsByUserId(token.FirstOrDefault());
|
||||
List<string> projects = new List<string>();
|
||||
if (ProjectItems.Count > 0)
|
||||
{
|
||||
projects = ProjectItems.Select(x => x.ProjectId).ToList();
|
||||
}
|
||||
if (item.Value != null && !projects.Contains(item.Value.ToString()))
|
||||
{
|
||||
//if (!isWithOut)
|
||||
//{
|
||||
// // 在调用 Action 方法之前执行的代码,可获取请求的接口名称和参数
|
||||
// IDictionary<string, object> arguments = actionContext.ActionArguments; // 获取参数
|
||||
// foreach (KeyValuePair<string, object> item in arguments)
|
||||
// {
|
||||
// if (item.Key.ToLower() == "projectid")
|
||||
// {
|
||||
// var ProjectItems = APIProjectService.geProjectsByUserId(token.FirstOrDefault());
|
||||
// List<string> projects = new List<string>();
|
||||
// if (ProjectItems.Count > 0)
|
||||
// {
|
||||
// projects = ProjectItems.Select(x => x.ProjectId).ToList();
|
||||
// }
|
||||
// if (item.Value != null && !projects.Contains(item.Value.ToString()))
|
||||
// {
|
||||
|
||||
actionContext.Response = actionContext.Request.CreateResponse(System.Net.HttpStatusCode.OK,
|
||||
new { code = "0", message = "您没有该项目权限!" }, actionContext.ControllerContext.Configuration.Formatters.JsonFormatter);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// actionContext.Response = actionContext.Request.CreateResponse(System.Net.HttpStatusCode.OK,
|
||||
// new { code = "0", message = "您没有该项目权限!" }, actionContext.ControllerContext.Configuration.Formatters.JsonFormatter);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
base.OnActionExecuting(actionContext);
|
||||
}
|
||||
else
|
||||
@@ -120,7 +120,7 @@ namespace WebAPI.Filter
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// 授权接口
|
||||
/// </summary>
|
||||
public static List<string> lists = new List<string>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user