zoukankan      html  css  js  c++  java
  • Landpy.ActiveDirecoty,按照Active Record Pattern设计的方便Lib开源发布

    想方便的操作AD吗,不想记住那么多AD Attribute名称和常量?请使用Landpy.ActiveDirecoty库,按照Active Record Pattern设计的AD Lib已经在CodePlex上开源发布。

    目前已知BoostSolutions AD产品线、Sony公司内部系统、Tempursealy公司、Lenovo公司使用。

    http://landpyactivedirectory.codeplex.com/

    Project Description

    Active Directory Object Model Library, which will help you to operate AD easily!
    This lib will bring you to the AD Active Record Parttern world, enjoy it now!

    Operate the Active Directory object with Active Record pattern, forget hundreds of the AD attribute names and AD attribute const values, forget all the details of the ActiveDirectory and enjoy your self.
    And you can also use the code to generate the filter to get the AD object search result, all the code is clear and simple. 
    More over: With the using code block you will dispose the no management resource easily. 
    Note: For more information and the getting start please visit the linkhttps://landpyactivedirectory.codeplex.com/documentation

    Eg: Update a user AD object.

    using (var userObject = UserObject.FindOneByCN(this.ADOperator, “pangxiaoliang”))
    {
         if(userObject.Email == "example@landpy.com")
         {
              userObject.Email = "mv@live.cn";
              userObject.Save();
         }
    }

    Eg: Query user AD objects.

    // 1. CN end with "liu", Mail conatains "live" (Eg: mv@live.cn), job title is "Dev" and AD object type is user.
    // 2. CN start with "pang", Mail conatains "live" (Eg: mv@live.cn), job title is "Dev" and AD object type is user.
                IFilter filter =
                    new And(
                        new IsUser(),
                        new Contains(PersonAttributeNames.Mail, "live"),
                        new Is(PersonAttributeNames.Title, "Dev"),
                        new Or(
                                new StartWith(AttributeNames.CN, "pang"),
                                new EndWith(AttributeNames.CN, "liu")
                            )
                        );
    // Output the user object display name.
    foreach (var userObject in UserObject.FindAll(this.ADOperator, filter))
    {
        using (userObject)
        {
            Console.WriteLine(userObject.DisplayName);
        }
    }

    Eg: Custom query.

    IFilter filter =
        new And(
            new IsUser(),
            new Custom("(!userAccountControl:1.2.840.113556.1.4.803:=2)")
            );
    // Output the user object display name.
    foreach (var userObject in UserObject.FindAll(this.ADOperator, filter))
    {
        using (userObject)
        {
            Console.WriteLine(userObject.DisplayName);
        }
    }

     

  • 相关阅读:
    java 前端--Jquery表单验证
    java基础--IO流(3)
    工具的使用与安装--myeclipse项目导入eclispse中的设置
    洛谷 P2697 宝石串
    洛谷 P2145 [JSOI2007]祖码
    洛谷 P1005 矩阵取数游戏
    洛谷 P3205 [HNOI2010]合唱队
    洛谷 P1220 关路灯
    POJ 2152 Fire
    洛谷 P1043 数字游戏
  • 原文地址:https://www.cnblogs.com/pangxiaoliang/p/ActiveDirectory.html
Copyright © 2011-2022 走看看