Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            RAFSecurity   _securityManager = new RAFSecurity();
            List <object> _dat             = _securityManager.searchForUsers(Page.User.Identity.Name, 5);

            if (_dat.Count != 0)
            {
                if (!(_securityManager.getUserRights((int)_dat[0] + "", "Page").Contains("PageRolModifications")))
                {
                    Response.Redirect("/default.aspx");
                }
            }
            if (!IsPostBack)
            {
                if (Request.QueryString["RolId"] != null)
                {
                    RolId.Value      = Request.QueryString["RolId"];
                    _securityManager = new RAFSecurity();
                    List <object> _data = _securityManager.searchForGroups(RolId.Value.ToString(), 2);
                    if (_data != null)
                    {
                        TBRolName.Text      = (String)_data[1];
                        TXBDescription.Text = (String)_data[2];
                        if ((Boolean)_data[3])
                        {
                            RaBuHabilitar.SelectedIndex = 0;
                        }
                        else
                        {
                            RaBuHabilitar.SelectedIndex = 1;
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        { //Permisos para esta página
            RAFSecurity   _securityManager = new RAFSecurity();
            List <object> _dat             = _securityManager.searchForUsers(Page.User.Identity.Name, 5);

            if (_dat.Count != 0)
            {
                if (!(_securityManager.getUserRights((int)_dat[0] + "", "Page").Contains("PageUserModifications")))
                {
                    Response.Redirect("/default.aspx");
                }
            }
            if (!IsPostBack)
            {
                if (Request.QueryString["ui"] != null)
                {
                    UserId.Value     = Request.QueryString["ui"];
                    _securityManager = new RAFSecurity();
                    List <object> _data = _securityManager.searchForUsers(UserId.Value.ToString(), 4);
                    if (_data != null)
                    {
                        if (_data[1].ToString() != null && _data[1].ToString() != "")
                        {
                            TBUserName.Text = (String)_data[1];
                        }
                        if (_data[2].ToString() != null && _data[2].ToString() != "")
                        {
                            nameT.Text = (String)_data[2];
                        }
                        if (_data[3].ToString() != null && _data[3].ToString() != "")
                        {
                            TBSecondName.Text = (String)_data[3];
                        }
                        if (_data[4].ToString() != null && _data[4].ToString() != "")
                        {
                            TBLastName1.Text = (String)_data[4];
                        }
                        if (_data[5].ToString() != null && _data[5].ToString() != "")
                        {
                            TBLastName2.Text = (String)_data[5];
                        }
                        if ((String)_data[6] == "E")
                        {
                            RaBuHabilitar.SelectedIndex = 0;
                        }
                        else
                        {
                            RaBuHabilitar.SelectedIndex = 1;
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            RAFSecurity   _securityManager = new RAFSecurity();
            List <object> _data            = _securityManager.searchForUsers(Page.User.Identity.Name, 5);

            if (_data.Count != 0)
            {
                if (!(_securityManager.getUserRights((int)_data[0] + "", "Section").Contains("SecCustomerSearch")))
                {
                    Response.Redirect("/default.aspx");
                }
            }
        }
        public override bool ValidateUser(string strName, string strPassword)
        {
            RAFSecurity _securityManager = new RAFSecurity();

            if (_securityManager.Login(strPassword, strName))
            {
                this._strName = strName;
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 5
0
        protected void getRights()
        {
            _sections.Clear();
            _Categories.Clear();
            _pages.Clear();
            RAFSecurity   _securityManager = new RAFSecurity();
            List <object> _data            = _securityManager.searchForUsers(Page.User.Identity.Name, 5);

            if (_data.Count != 0)
            {
                _sections   = _securityManager.getUserRights((int)_data[0] + "", "Section");
                _Categories = _securityManager.getUserRights((int)_data[0] + "", "Category");
                _pages      = _securityManager.getUserRights((int)_data[0] + "", "Page");
            }
        }
Ejemplo n.º 6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try{
         //if just logged out
         if (Request.QueryString["a"].ToString() == "l")
         {
             RAFSecurity _securityManager = new RAFSecurity();
             _securityManager.Logout(Membership.Provider.Name);
             LoginView1.FindControl("logoutMsg").Visible = true;
             Response.Redirect("/default.aspx");
         }
         else
         {
             LoginView1.FindControl("logoutMsg").Visible = false;
         }
     }
     catch (Exception x)
     {
         x.Message.Trim();
     }
 }
Ejemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            RAFSecurity   _securityManager = new RAFSecurity();
            List <object> _data            = _securityManager.searchForUsers(Page.User.Identity.Name, 5);

            if (_data.Count != 0)
            {
                if (!(_securityManager.getUserRights((int)_data[0] + "", "Page").Contains("PageCustomerInfo")))
                {
                    Response.Redirect("/default.aspx");
                }
            }

            if (!IsPostBack)
            {
                if (Request.QueryString["cu"] != null)
                {
                    custIDHid.Value = Request.QueryString["cu"];
                }
            }
        }
Ejemplo n.º 8
0
 protected void BTNNewUser_Click(object sender, EventArgs e)
 {
     if (TXBDescription.Text != null)
     {
         RAFSecurity _securityManager = new RAFSecurity();
         if (RaBuHabilitar.SelectedIndex == 0)
         {
             if (_securityManager.updateGroup(TBRolName.Text, TXBDescription.Text, 1))
             {//success
             }
             //fail error
         }
         else
         {
             if (_securityManager.updateGroup(TBRolName.Text, TXBDescription.Text, 0))
             {//sucess
             }
             //fail error
         }
     }
     //fail error
 }
Ejemplo n.º 9
0
        protected void BTNNewRol_Click(object sender, EventArgs e)
        {
            RAFSecurity _securityManager = new RAFSecurity();

            if (TBDescription.Text.Length < 255 && TBDescription.Text.Length > 1 && TBRolName.Text != null)
            {
                if (_securityManager.insertGroup(TBRolName.Text, TBDescription.Text))
                {
                    int idRol = _securityManager.searchForGroup(TBRolName.Text, 0);
                    Response.Redirect("/RolModifications.aspx?RolId=" + idRol);
                }
                {
                    errorMsg.Text    = "Error el Nombre del rol ya está en uso";
                    errorMsg.Visible = true;
                }
            }
            else
            {
                errorMsg.Text    = "Ingrese los datos correctamente";
                errorMsg.Visible = true;
            }
        }
Ejemplo n.º 10
0
        protected void BTNNewUser_Click(object sender, EventArgs e)
        {
            if (nameT.Text != null && TBSecondName.Text != null && TBLastName1.Text != null && TBLastName2.Text != null)
            {
                RAFSecurity _securityManager = new RAFSecurity();
                int         _userId          = int.Parse(UserId.Value);

                if (TBOldPass.Text.Length > 6 && TBPassConfirm.Text == TBPass.Text && TBPassConfirm.Text.Length > 6)
                {
                    if (_securityManager.passwordChange(TBUserName.Text, TBOldPass.Text, TBPass.Text, UserId.Value.ToString()))
                    {    //success
                    }
                    else
                    {    //Fail pass
                        return;
                    }
                }

                if (RaBuHabilitar.SelectedIndex == 0)
                {
                    if (_securityManager.updateUser(nameT.Text, TBSecondName.Text, TBLastName1.Text, TBLastName2.Text, "E", TBUserName.Text, _userId))
                    {//success
                    }
                    //fail error
                    return;
                }
                else
                {
                    if (_securityManager.updateUser(nameT.Text, TBSecondName.Text, TBLastName1.Text, TBLastName2.Text, "D", TBUserName.Text, _userId))
                    {//sucess
                    }
                    //fail error
                    return;
                }
            }
            //fail error
        }
Ejemplo n.º 11
0
        protected void BTNNewUser_Click(object sender, EventArgs e)
        {
            RAFSecurity _securityManager = new RAFSecurity();

            if (TBUserName.Text != null && TBPass.Text == TBPassConfirm.Text && TBPass.Text.Length > 5)
            {
                if (_securityManager.insertUser(TBUserName.Text, TBPass.Text, nameT.Text, TBSecondName.Text, TBLastName1.Text, TBLastName2.Text, Membership.Provider.Name))
                {
                    List <object> _result = _securityManager.searchForUsers(TBUserName.Text, 5);

                    Response.Redirect("/UserModifications.aspx?ui=" + _result[0]);
                }
                else
                {
                    errorMsg.Text    = "Error el Nombre del Usuario ya está en uso";
                    errorMsg.Visible = true;
                }
            }
            else
            {
                errorMsg.Text    = "Ingrese los datos correctamente";
                errorMsg.Visible = true;
            }
        }
Ejemplo n.º 12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            RAFSecurity _securityManager = new RAFSecurity();
            String      plap             = Request.QueryString["code"].ToString();
            int         asd = String.Compare(plap, "1");

            if (Request.QueryString["code"].ToString() == "1" || Request.QueryString["code"].ToString() == "3")
            {
                String _gp   = Request.QueryString["gp"];
                String _user = Request.QueryString["ui"];
                if (_securityManager.deleteMembership(_user, _gp))
                {
                    if (Request.QueryString["code"].ToString() == "3")
                    {
                        Response.Redirect("/rolModifications.aspx?code=3&resp=1&RolId=" + _gp);
                    }
                    else
                    {
                        Response.Redirect("/UserModifications.aspx?code=1&resp=1&ui=" + _user);
                    }
                }
                else
                {
                    if (Request.QueryString["code"].ToString() == "3")
                    {
                        Response.Redirect("/rolModifications.aspx?code=3&resp=0&RolId=" + _gp);
                    }
                    else
                    {
                        Response.Redirect("/UserModifications.aspx?code=1&resp=0&ui=" + _user);
                    }
                }
            }
            else if (Request.QueryString["code"].ToString() == "2" || Request.QueryString["code"].ToString() == "4")
            {
                String _gp   = Request.QueryString["gp"];
                String _user = Request.QueryString["ui"];
                if (_securityManager.addMembership(_user, _gp))
                {
                    if (Request.QueryString["code"].ToString() == "2")
                    {
                        Response.Redirect("/UserModifications.aspx?code=2&resp=1&ui=" + _user);
                    }
                    else
                    {
                        Response.Redirect("/rolModifications.aspx?code=4&resp=0&RolId=" + _gp);
                    }
                }
                else
                {
                    if (Request.QueryString["code"].ToString() == "2")
                    {
                        Response.Redirect("/UserModifications.aspx?code=2&resp=0&ui=" + _user);
                    }
                    else
                    {
                        Response.Redirect("/rolModifications.aspx?code=4&resp=0&RolId=" + _gp);
                    }
                }
            }
            else if (Request.QueryString["code"].ToString() == "5")
            {
                String _gp    = Request.QueryString["gp"];
                String _ident = Request.QueryString["ident"];
                String _type  = Request.QueryString["type"];
                if (_securityManager.addRights(_gp, _type, _ident))
                {
                    Response.Redirect("/rolModifications.aspx?code=5&resp=1&RolId=" + _gp);
                }
                else
                {
                    Response.Redirect("/rolModifications.aspx?code=5&resp=0&RolId=" + _gp);
                }
            }
            else if (Request.QueryString["code"].ToString() == "6")
            {
                String _gp    = Request.QueryString["gp"];
                String _ident = Request.QueryString["ident"];
                String _type  = Request.QueryString["type"];
                if (_securityManager.DeleteRights(_gp, _type, _ident))
                {
                    Response.Redirect("/rolModifications.aspx?code=6&resp=1&RolId=" + _gp);
                }
                else
                {
                    Response.Redirect("/rolModifications.aspx?code=6&resp=0&RolId=" + _gp);
                }
            }
            else
            {
            }
        }