Ejemplo n.º 1
0
        /// <summary>
        /// check program access right
        /// </summary>
        /// <param name="progList">program list</param>
        /// <param name="prog">program id</param>
        /// <param name="crudFun">crud function, see CrudFunEstr, empty for controller, value for action</param>
        /// <returns>bool</returns>
        public static bool CheckAuth(string progList, string prog, CrudFunEnum crudFun)
        {
            var comma = ",";

            progList = comma + progList + comma;
            if (crudFun == CrudFunEnum.Empty)
            {
                //prog add tail of ','
                return(progList.Contains(comma + prog + comma));
            }
            else
            {
                //prog add tail of ':'
                var funList = _Str.GetMid(progList, comma + prog + ":", comma);
                var funPos  = (int)crudFun;
                return(funList.Length > funPos && funList.Substring(funPos, 1) == "1");
            }
        }
Ejemplo n.º 2
0
 public XgProgAuthAttribute(CrudFunEnum funType = CrudFunEnum.Empty)
 {
     _funType = funType;
 }