Ejemplo n.º 1
0
 public function testToLdapArray()
 {
     $attributes = ['username' => 'Jdoe', 'storageGroup' => 'Test', 'emailAddress' => '*****@*****.**'];
     $mailbox = new Mailbox($attributes);
     $expected = ['exchange_homemdb' => ',', 'exchange_proxyaddress' => 'SMTP:jdoe@email.com', 'exchange_mailnickname' => null, 'exchange_usedefaults' => null];
     $this->assertEquals($expected, $mailbox->toLdapArray());
 }
Ejemplo n.º 2
0
 public function createMailbox($username, $storageGroup, $emailAddress, $mailNickname = null, $useDefaults = true, $baseDn = null, $isGUID = false)
 {
     $mailbox = new Mailbox(['username' => $username, 'storageGroup' => $storageGroup, 'emailAddress' => $emailAddress, 'mailNickname' => $mailNickname, 'baseDn' => $baseDn ? $baseDn : $this->adldap->getBaseDn(), 'mdbUseDefaults' => $this->adldap->utilities()->boolToStr($useDefaults)]);
     // Validate the mailbox fields
     $mailbox->validateRequired();
     // Set the container attribute by imploding the storage group array
     $mailbox->setAttribute('container', 'CN=' . implode(',CN=', $storageGroup));
     // Set the mail nickname to the username if it isn't provided
     if ($mailbox->{'mailNickname'} === null) {
         $mailbox->setAttribute('mailNickname', $mailbox->{'username'});
     }
     // Perform the creation and return the result
     return $this->adldap->user()->modify($username, $mailbox->toLdapArray(), $isGUID);
 }