天津投入产出系统后端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

67 lines
1.6 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using QMAPP.Common.Web.Util;
using QMAPP.Common.Web.Controllers;
using QMAPP.Entity.Sys;
using System.Collections;
namespace QMAPP.Web.Common
{
/// <summary>
/// 判断权限是否有效
/// 创建者:郭佳伟
/// 创建时间:2013.02.07
/// </summary>
public class ActionAuthorityFilter : FilterAttribute, IActionFilter
{
/// <summary>
/// 是否具有权限
/// </summary>
private bool isAuthority { get; set; }
/// <summary>
/// 权限编号
/// </summary>
public string PowerID { get; set; }
public ActionAuthorityFilter(string inPowerID)
{
isAuthority = false;
PowerID = inPowerID;
//取得当前用户权限所对应的菜单
Hashtable pil = AccountController.GetLimit();
//如果是管理员,那么就不限制
if (AccountController.GetLoginInfo().LoginUserID == "admin")
{
isAuthority = true;
}
else
{
Hashtable actionList = AccountController.GetLimit();
bool flag = actionList.ContainsKey(PowerID);
isAuthority = flag;
}
}
void IActionFilter.OnActionExecuted(ActionExecutedContext filterContext)
{
}
void IActionFilter.OnActionExecuting(ActionExecutingContext filterContext)
{
}
}
}