Beispiel #1
0
    /// <summary>
    /// 检测管理员是否有当前模块权限
    /// </summary>
    /// <param name="Flag"></param>
    /// <returns></returns>
    public static bool CheckAdminHavePower1(string FlagAct)
    {
        bool flag = false;
        //admin
        int userID = Sys.BLL.Account.GetLoginAdminID();

        Sys.BLL.Admin   bllAdmin   = new Sys.BLL.Admin();
        Sys.Model.Admin modelAdmin = bllAdmin.GetModel(userID);
        //adminFlag
        Sys.BLL.AdminFlag          bllFlag = new Sys.BLL.AdminFlag();
        List <Sys.Model.AdminFlag> list    = bllFlag.GetList(0, -1, -1, FlagAct);

        foreach (Sys.Model.AdminFlag model in list)
        {
            modelAdmin.UserFlag = "," + modelAdmin.UserFlag + ",";
            if (modelAdmin.UserFlag.IndexOf("," + model.Flag + ",") != -1)
            {
                flag = true;
            }
        }
        return(flag);
    }
Beispiel #2
0
    /// <summary>
    /// 检测管理员是否有当前模块权限
    /// </summary>
    /// <param name="Flag"></param>
    /// <returns></returns>
    public static bool CheckAdminHavePower(string Flag)
    {
        bool flag   = false;
        int  userID = Sys.BLL.Account.GetLoginAdminID();
        var  bll    = new Sys.BLL.Admin();

        Sys.Model.Admin model = bll.GetModel(userID);
        model.UserFlag = "," + model.UserFlag + ",";

        //Flag = Flag.Substring(Flag.IndexOf("_") + 1, Flag.Length - Flag.IndexOf("_") - 1);

        //if (model.UserFlag.ToLower().IndexOf("_" + Flag + ",") != -1)
        //{
        //    flag = true;
        //}

        if (model.UserFlag.ToLower().IndexOf(Flag) != -1)//ZJY
        {
            flag = true;
        }
        return(flag);
    }
Beispiel #3
0
    /// <summary>
    /// 登陆
    /// </summary>
    private void UserLogin()
    {
        //URL登陆定向,涉及SSO登陆
        if (url.Length > 7 && url.Substring(0, 7) == "http://")
        {
            url = "";
        }
        else
        {
            url = Utils.UrlEncode(url);
        }

        //用户名字段判断
        if (username == "")
        {
            Response.Redirect("login.aspx?url=" + url + "&errmsg=帐户为空,请重新输入!&username="******"")
        {
            Response.Redirect("login.aspx?url=" + url + "&errmsg=密码为空,请重新输入!&username="******"")
        //    Response.Redirect("login.aspx?url=" + url + "&errmsg=验证码为空,请重新输入!&username="******"ValidateCode"].Value.ToLower())
        //    Response.Redirect("login.aspx?url=" + url + "&errmsg=验证码不正确,请重新输入!&username="******"WebConfig", "AdminIpBlockType", 0);
        switch (AdminIpBlockType)
        {
        case 0:
            break;

        case 1:
        {
            var bllIpBlock = new Sys.BLL.SysIpBlock();
            if (bllIpBlock.Exists(0, 1, Utils.GetRealIP()))
            {
                Response.Redirect("login.aspx?url=" + url + "&errmsg=当前IP被限制登录系统后台!&username="******"login.aspx?url=" + url + "&errmsg=当前IP被限制登录系统后台!&username="******"login.aspx?url=" + url + "&errmsg=帐户不存在!&username="******"login.aspx?url=" + url + "&errmsg=密码不正确!&username="******"login.aspx?url=" + url + "&errmsg=该账户无权登陆系统!&username="******"login.aspx?url=" + url + "&errmsg=该账户禁止登陆系统!&username="******"login.aspx?url=" + url + "&errmsg=该账户无权登陆系统后台!&username="******"login.aspx?url=" + url + "&errmsg=该账户禁止登陆系统后台!&username="******"managelogin", "登陆成功");

        //Cookie保存-帐户
        Sys.BLL.Admin.SetUsername(modelAdmin.Username);
        //Cookie保存-姓名
        Sys.BLL.Admin.SetRealName(modelAdmin.RealName);

        //Cookie保存-rememberme
        if (PageRequest.GetInt("rememberme", 0) == 1)
        {
            Utils.WriteCookie("manage_LoginName", Utils.UrlEncode(username), 518400, ConfigHelper.GetConfigString("CookieDomain"));
        }

        if (modelAdmin.Username == modelAdmin.RealName)
        {
            Response.Redirect("main.aspx?url=" + Utils.UrlEncode("user/profile.aspx"));
        }
        else if (url != "")
        {
            Response.Redirect("main.aspx?url=" + Utils.UrlEncode(url));
        }
        else
        {
            Response.Redirect("main.aspx");
        }
    }