/// <summary> /// The class initialisation method. /// </summary> public EvAdsProfiles( ) { this.LogInitMethod("EvAdsProfiles"); EvAdsConfig adConfig = new EvAdsConfig { Server = _server, AdminName = _adminName, AdminPassword = _adminPassword, RootContainer = _rootContainer, UsersContainer = _rootContainer, GroupsContainer = _rootContainer, LdapString = _ldapString }; this.LogInit("Server: " + _server); this.LogInit("adminName: " + _adminName); this.LogInit("adminPassword: "******"rootContainer: " + _rootContainer); this.LogInit("ldapString: " + _ldapString); _evAdFacade = EvAdsFacadeFactory.CreateFacade(adConfig); this.LogAssembly(this._evAdFacade.Log); this.LogInitMethodEnd("EvAdsProfiles"); }
// ================================================================================== /// <summary> /// Creates the Evado Active Directory facade Object. /// </summary> /// <param name="Config">Configuration value to setup active directory connection up</param> /// <returns>EvAdFacade</returns> /// <exception cref="System.ArgumentException">If EvAdConfig value is improper.</exception> /// <example> /// <code> /// EvAdConfig config = new EvAdConfig() /// { /// Server = "192.168.10.53", /// ContextType = ContextType.Domain, /// RootContainer = "OU=Test Users,DC=evado,DC=local", /// UsersContainer = "OU=Test Users,DC=evado,DC=local", /// GroupsContainer = "OU=Test Users,DC=evado,DC=local", /// AdminName = @"evado", /// AdminPassword = "******", /// LdapString = "LDAP://192.168.10.53/dc=evado,dc=local" /// }; /// /// EvAdsFacade adFacade = EvAdFacadeFactory.CreateFacade(config); /// </code> /// </example> // ------------------------------------------------------------------------------------- public static EvAdsFacade CreateFacade(EvAdsConfig Config) { Config.ContextType = ContextType.Domain; if (ConfigParamValidator(Config) == false) { throw new ArgumentException("EvAdsConfig value is invalid. Some values are Null or Empty"); } return(new EvAdsFacade(Config)); }
// ================================================================================== /// <summary> /// Validate the Config value. /// </summary> /// <param name="Config">Configuration value to setup active directory connection up</param> /// <returns><c>true</c> if any of Config Property is improper, /// <c>false</c> otherwise</returns> // ------------------------------------------------------------------------------------- private static bool ConfigParamValidator(EvAdsConfig Config) { // // Check if string value is either Null or Empty // var validation = String.IsNullOrEmpty(Config.Server) != true && String.IsNullOrEmpty(Config.RootContainer) != true && String.IsNullOrEmpty(Config.GroupsContainer) != true && String.IsNullOrEmpty(Config.UsersContainer) != true && String.IsNullOrEmpty(Config.AdminName) != true && String.IsNullOrEmpty(Config.AdminPassword) != true && String.IsNullOrEmpty(Config.LdapString) != true; return(validation); }