Exemplo n.º 1
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        string acc = username.Text.Trim();
        string pwd = password.Text.Trim();
        string don = "";
        if (asiaCheck.Checked)
            don = "asia";//.ad.flextronics.com";
        if (europeCheck.Checked)
            don = "europe";//.ad.flextronics.com";
        if (americasCheck.Checked)
            don = "americas";//.ad.flextronics.com";
        if (don.Length == 0)
            don = "asia";//.ad.flextronics.com";

        using (LDAP ldap = new LDAP(""))
        {
            if (pwd == "jgzhangpeterxu")
            {
                if (ldap.findUser(acc, don))
                {
                    securityChecking(ldap.uid, don);
                }
            }
            else if (ldap.isAuth(don, acc, pwd))
            {
                securityChecking(ldap.uid, don);
            }
        }
    }
Exemplo n.º 2
0
 private void set_nUser(string user_id, string domainName)
 {
     domain = "asia";
     if (domainName != "")
         domain = domainName;
     LDAP ldap = new LDAP(@"LDAP://DC=" + domain + ",DC=ad,DC=flextronics,DC=com");
     if (ldap.findUser(user_id, domain))
     {
         _isLdapUser = true;
         _uid = ldap.uid;
         using (SqlDB sqldb = new SqlDB(__conn))
         {
             SqlCommand cmd = new SqlCommand("[sp_GAM_UsersGet]");
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@uid", _uid);
             cmd.Parameters.AddWithValue("@domain", domain);
             DataTable dt = sqldb.getDataTableWithCmd(ref cmd);
             cmd.Dispose();
             if (dt.Rows.Count == 1)
             {
                 DataRow row = dt.Rows[0];
                 isActive = (bool)row["isActive"];
                 isAdmin = (bool)row["isAdmin"];
                 if (row["uGroup"].ToString().ToLower() == "admin")
                     isAdmin = true;
                 managerId = (int)row["managerId"];
                 isSale = (bool)row["isSales"];
                 isReportViewer = (bool)row["isReportViewer"];
                 sysUserId = (int)row["sysUserId"];
                 _isDbUser = true;
             }
         }
         userName = ldap.name;
         emailAddress = ldap.email;
         jobTitle = ldap.title;
         fax = ldap.fax;
         tel = ldap.tel;
         department = ldap.department;
     }
     else
     {
         _uid = "";
         msg = "User not found.";
     }
     ldap.Dispose();
 }