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

     

  • 相关阅读:
    Android开发中,有哪些让你觉得相见恨晚的方法、类或接口?
    Android实用代码七段(五)
    Android实用代码七段(四)
    Android实用代码七段(三)
    Android实用代码七段(二)
    android实用代码
    发送Notification
    按两次back键退出程序
    java常用的几种设计模式
    拍照获取图片和相册中获取图片
  • 原文地址:https://www.cnblogs.com/pangxiaoliang/p/ActiveDirectory.html
Copyright © 2011-2022 走看看