Ejemplo n.º 1
0
 public static void Insert(M_UserExpHis model)
 {
     if (model.UserID == 0)
     {
         M_UserInfo mu = new B_User().GetLogin();
         if (mu != null)
         {
             model.UserID = mu.UserID;
         }
     }
     if (model.Operator == 0)
     {
         M_AdminInfo adminMod = B_Admin.GetLogin();
         if (adminMod != null)
         {
             model.Operator = adminMod.AdminId;
         }
     }
     if (string.IsNullOrEmpty(model.OperatorIP))
     {
         model.OperatorIP = IPScaner.GetUserIP();
     }
     if (string.IsNullOrEmpty(model.Remark) && HttpContext.Current != null)
     {
         model.Remark = HttpContext.Current.Request.RawUrl;
     }
     if (model.HisTime <= DateTime.MinValue)
     {
         model.HisTime = DateTime.Now;
     }
     model.TbName = GetTbName((SType)model.ScoreType);
     DBCenter.Insert(model);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 如非超管,则跳转
        /// </summary>
        public static void IsSuperManage()
        {
            M_AdminInfo model = B_Admin.GetLogin();

            if (model == null || model.AdminId < 1 || !IsSuperManage(model.AdminId))
            {
                throw new Exception("非超级管理员,无权访问该页面");
            }
        }
Ejemplo n.º 3
0
        public static bool CheckEx(Model.ZLEnum.Auth authfield, string code)
        {
            M_AdminInfo adminMod = B_Admin.GetLogin();

            if (adminMod.IsSuperAdmin())
            {
                return(true);
            }
            bool result = Check(adminMod.RoleList, authfield, code);

            if (!result)
            {
                throw new Exception("你无权进行此项操作");
            }
            return(result);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 获取当前登录用户在节点中所拥有的权限列表,(ZL_NodeRole)RID:角色,NID:节点,look:查看
        /// </summary>
        /// <returns></returns>
        public DataTable GetNodeAuthList(string auth = "")
        {
            SafeSC.CheckDataEx(auth);
            M_AdminInfo m = B_Admin.GetLogin();

            if (m == null || m.AdminId < 1 || string.IsNullOrEmpty(m.RoleList.Replace(",", "")))
            {
                return(null);
            }
            string where = "Rid in (" + m.RoleList.Trim(',') + ")";
            if (!string.IsNullOrEmpty(auth))
            {
                where += " And " + auth + " =1";
            }
            return(DBCenter.Sel("ZL_NodeRole", where));
        }
Ejemplo n.º 5
0
 private static M_Log EmptyDeal(Model.ZLEnum.Log type, M_Log model)
 {
     if (string.IsNullOrEmpty(model.Action))
     {
         model.Action = type.ToString();
     }
     if (model.CDate <= DateTime.MinValue)
     {
         model.CDate = DateTime.Now;
     }
     try
     {
         if (string.IsNullOrEmpty(model.IP))
         {
             model.IP = IPScaner.GetUserIP();
         }
         if (string.IsNullOrEmpty(model.Source))
         {
             model.Source = HttpContext.Current.Request.RawUrl;
         }
     }
     catch { }
     if (type == Model.ZLEnum.Log.fileup || type == Model.ZLEnum.Log.safe)
     {
         try
         {
             if (string.IsNullOrEmpty(model.UName))
             {
                 M_UserInfo mu = new B_User().GetLogin(); if (mu != null && mu.UserID != 0)
                 {
                     model.UName = mu.UserName;
                 }
             }
             if (string.IsNullOrEmpty(model.AName))
             {
                 M_AdminInfo adminMod = B_Admin.GetLogin(); if (adminMod != null && adminMod.AdminId > 0)
                 {
                     model.AName = adminMod.AdminName;
                 }
             }
         }
         catch { }
     }
     return(model);
 }
Ejemplo n.º 6
0
        public static bool Check(Model.ZLEnum.Auth authfield, string code)
        {
            M_AdminInfo adminMod = B_Admin.GetLogin();

            return(Check(adminMod.RoleList, authfield, code));
        }
Ejemplo n.º 7
0
        //---------------------Ignore
        /// <summary>
        /// 检测二级密码
        /// </summary>
        public bool CheckSPwd(string pwd)
        {
            M_AdminInfo admin = B_Admin.GetLogin();

            return(CheckSPwd(admin, pwd));
        }
Ejemplo n.º 8
0
 public M_AdminInfo GetAdminLogin()
 {
     B_Admin.CheckIsLogged();
     return(B_Admin.GetLogin());
 }