Beispiel #1
0
        private void Insert_Grant()
        {
            DataTable temp = (DataTable)Priv_dataGridView.DataSource;

            foreach (DataRow dr in temp.Rows)
            {
                string table_name = dr["OWNER"].ToString() + "." + dr["TABLE_NAME"].ToString();
                Oracle.revoke_priv(MainForm.Login_Form.conn, table_name, MainForm.username, "INSERT");
            }

            foreach (DataRow dr in temp.Rows)
            {
                if (Convert.ToBoolean(dr["ENABLED"]))
                {
                    string table_name = dr["OWNER"].ToString() + "." + dr["TABLE_NAME"].ToString();;
                    if (Convert.ToBoolean(dr["WITH GRANT OPTION"]))
                    {
                        Oracle.Grant_Insert(MainForm.Login_Form.conn, table_name, MainForm.username, true);
                    }
                    else
                    {
                        Oracle.Grant_Insert(MainForm.Login_Form.conn, table_name, MainForm.username, false);
                    }
                }
            }
        }
Beispiel #2
0
        private int Insert_Grant()
        {
            DataTable temp = (DataTable)Priv_dataGridView.DataSource;

            foreach (DataRow dr in temp.Rows)
            {
                if (Convert.ToBoolean(dr["ENABLED"]) && dr["TABLE_NAME"].ToString() == "LUONG")
                {
                    MessageBox.Show("BANG " + dr["TABLE_NAME"].ToString().ToUpper() + "ĐÃ ĐƯỢC MÃ HÓA, KHÔNG ĐƯỢC PHÉP ADD QUYỀN SELECT QUA APP!!", "WARNING", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(0);
                }
            }
            MainForm.Login_Form.conn.Open();

            foreach (DataRow dr in temp.Rows)
            {
                string table_name = dr["OWNER"].ToString() + "." + dr["TABLE_NAME"].ToString();
                Oracle.revoke_priv(MainForm.Login_Form.conn, table_name, MainForm.username, "INSERT");
            }

            foreach (DataRow dr in temp.Rows)
            {
                if (Convert.ToBoolean(dr["ENABLED"]) && MainForm.is_user)
                {
                    string table_name = dr["OWNER"].ToString() + "." + dr["TABLE_NAME"].ToString();;
                    if (Convert.ToBoolean(dr["WITH GRANT OPTION"]))
                    {
                        Oracle.Grant_Insert(MainForm.Login_Form.conn, table_name, MainForm.username, true);
                    }
                    else
                    {
                        Oracle.Grant_Insert(MainForm.Login_Form.conn, table_name, MainForm.username, false);
                    }
                }
            }
            MainForm.Login_Form.conn.Close();
            return(1);
        }