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);
        }
    }

     

  • 相关阅读:
    正则表达式
    linux中的三种时间
    用户,用户组
    inode与block
    linux文件属性
    linux的启动过程
    linux的重要子目录
    mail邮箱
    spark原理
    spark部署
  • 原文地址:https://www.cnblogs.com/pangxiaoliang/p/ActiveDirectory.html
Copyright © 2011-2022 走看看