在ldap中更改objectclass

时间:2016-02-02 07:54:50

标签: c# ldap novell

我使用Novell.Directory.Ldap库在ldap(使用Oracle目录服务企业版11.1.1.5的Alcatel Omnivista)中创建用户。

它已经工作多年了但是自从Omnivista的最新更新以来,管理员正在为我创建的用户带来一个问题:对象类的顺序错误

它应该在哪里

objectclass: inetOrgPerson
objectclass: organizationalPerson
objectclass: person
objectclass: top
objectclass: CDPerson

它是:

LdapAttributeSet attributeSet = new LdapAttributeSet
{
    new LdapAttribute("objectclass", "inetOrgPerson"),
    new LdapAttribute("cn", new[] {cg.Cn, cg.Cn}),
    new LdapAttribute("sn", cg.Sn)
};

因此他们的管理应用程序工作正常。

我使用以下初始化代码:

protected void Page_Load(object sender, EventArgs e)
{  
    TextBox1.Text = "9";
    DataTable dt = new DataTable();
    String str = "select * from tbl1 where br=@search and Date between @search1 and @search2  ";
    SqlCommand xp = new SqlCommand(str, con);
    xp.Parameters.Add("@search", SqlDbType.VarChar).Value = TextBox1.Text;
    xp.Parameters.Add("@search1", SqlDbType.VarChar).Value = TextBox2.Text;
    xp.Parameters.Add("@search2", SqlDbType.VarChar).Value = TextBox3.Text;
    con.Open();
    SqlDataAdapter da = new SqlDataAdapter();
    da.SelectCommand = xp;
    da.Fill(dt);
    con.Close();
    if (dt.Rows.Count > 0)
    {
        ReportDocument crystalReport = new ReportDocument();
        crystalReport.SetParameterValue("search", "I am search");
        crystalReport.Load(Server.MapPath("CrystalReport.rpt"));
        crystalReport.SetDatabaseLogon("xx", "xxxx");
        crystalReport.SetDataSource(dt);
        CrystalReportViewer1.ReportSource = crystalReport;
        CrystalReportViewer1.DataBind();
    }

我的问题是:

  • 这是一个真正的问题吗?订单重要吗?暗示管理应用程序中存在错误。
  • 我可以在创建时更改对象类吗?之后呢?我是不是该 ?
  • 或者是ldap中的配置相关吗?

非常感谢!!

2 个答案:

答案 0 :(得分:2)

在LDAP中,属性(例如objectclass)具有一组值,因此顺序无关紧要。

应用程序不应该依赖于值的顺序,所以我会说它是Admin应用程序中的一个错误。

某些服务器确实保留了客户端提供的值的顺序,有些服务器没有,但我不知道行为可配置的位置。

答案 1 :(得分:1)

我设法在创建时更改了对象类,现在应用程序运行良好。 尽管如此,我认为应用程序在某些时候是错误的。

参考代码,如果有人在某天需要它:

LdapAttributeSet attributeSet = new LdapAttributeSet
{
     new LdapAttribute("objectclass", new[] {"top", "person", "organizationalPerson", "inetorgperson", "CDPerson"}),
     new LdapAttribute("cn", new[] {cg.Cn, cg.Cn}),
     new LdapAttribute("sn", cg.Sn),
};