/** * Get the default address list for the domain forest * * @return Object The default global address list */ public function defaultGAL() { if ($this->gal instanceof Object) { return $this->gal; } $task = new \ADX\Core\Task(Enums\Operation::OpSearch, $this->link); $gal = $task->base(static::$base)->filter(q::a(['objectCategory' => 'msExchConfigurationContainer']))->attributes('globalAddressList')->run()->first(); $this->gal = Object::read($gal->globalAddressList(0), static::$attributes, $this->link); return $this->gal; }
/** * Create the user on the server * * This method provides some extra functionality to the standard * {@link ADX\Core\Object::create()} method. * * If you have set the user's password then the following updates will be * made to the user account: * * - The {@link ADX\Enums\UAC::PasswdNotReqd} bit will be turned **off** * - The user account will be created as **enabled** * - The user will **not** be forced to change the password unless you have explicitly * forced a password change with {@link self::force_password_change()} * * <br> * If, for whatever reason you need any of the above `userAccountControl` bits to be different * you must override the values **after** the user has been created on the server, * meaning, after you have called the `create()` method on the object. * * @param string The distinguished name of the parent container where this user should be stored * * @return self */ public function create($dn) { // Check if password has been set since initialisation and modify UserAccountControl // to enable the account but also to require password for logon if (in_array('unicodepwd', $this->all_attributes())) { $this->bit_state('userAccountControl', Enums\UAC::PasswdNotReqd, false); $this->bit_state('userAccountControl', Enums\UAC::AccountDisable, false); } return parent::create($dn); }
/** * Read information from the RootDSE entry * * Use this method to read information from the RootDSE entry of the directory server. * * The following information ( each represented as {@link Attribute} ) * is always available: * * - dnshostname * - defaultnamingcontext * - highestcommittedusn * - supportedcontrol * - supportedldapversion * - supportedsaslmechanisms * - rootdomainnamingcontext * - configurationnamingcontext * - schemanamingcontext * - namingcontexts * - currenttime * * <br> * Note that you do not need to use this method each time * you need to read information from rootDSE - simply access the information * straight away via `$link->rootDSE->property_name()` and the class will take * care of the rest. In fact, accessing the property is faster because the library * caches to rootDSE information for you and only reloads when calling this method. * * <h4>Example</h4> * <code> * $link = new Link( 'example.com' ); // Connect to server * $object = $link->rootDSE(); // Load default attribute set from the RootDSE * // Do something with Object... * $currentTime = $object->currentTime->value(0); * </code> * * @see <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms684291%28v=vs.85%29.aspx">MSDN - RootDSE</a> * @uses Object::read() * @param string|array One or more attributes you wish to have retrieved in addition to the default set * * @return Object The Object representing the RootDSE entry with requested attributes */ public function rootDSE($attributes = []) { $get = ['dnshostname', 'defaultnamingcontext', 'highestcommittedusn', 'supportedcontrol', 'supportedldapversion', 'supportedsaslmechanisms', 'rootdomainnamingcontext', 'configurationnamingcontext', 'schemanamingcontext', 'namingcontexts', 'currenttime']; $attributes = array_merge($get, (array) $attributes); // Read the rootDSE $this->rootDSE = Object::read('', $attributes, $this); return $this->rootDSE; }