Пример #1
0
 /**
  * Add an entry to our document.
  * 
  * @param  LdapUser $userOrGroup
  * @return void
  * @access protected
  * @since 3/30/09
  */
 protected function addEntry(LdapUser $userOrGroup)
 {
     try {
         print "\n\t<cas:entry>";
         if ($userOrGroup->isGroup()) {
             print "\n\t\t<cas:group>" . htmlentities($userOrGroup->getId()) . "</cas:group>";
         } else {
             print "\n\t\t<cas:user>" . htmlentities($userOrGroup->getId()) . "</cas:user>";
         }
         foreach ($userOrGroup->getAttributeKeys() as $attribute) {
             foreach ($userOrGroup->getAttributeValues($attribute) as $value) {
                 print "\n\t\t<cas:attribute name=\"" . $attribute . "\" value=\"" . htmlentities($value) . "\"/>";
             }
         }
         print "\n\t</cas:entry>";
     } catch (OperationFailedException $e) {
         print_r($userOrGroup);
         throw $e;
     }
 }
 /**
  * Add an entry to our document.
  * 
  * @param  LdapUser $userOrGroup
  * @return void
  * @access protected
  * @since 3/30/09
  */
 protected function addEntry(LdapUser $userOrGroup)
 {
     try {
         $elem = $this->doc->documentElement->appendChild($this->doc->createElementNS('http://www.yale.edu/tp/cas', 'cas:entry'));
         if ($userOrGroup->isGroup()) {
             $elem->appendChild($this->doc->createElementNS('http://www.yale.edu/tp/cas', 'cas:group', htmlspecialchars($userOrGroup->getId())));
         } else {
             $elem->appendChild($this->doc->createElementNS('http://www.yale.edu/tp/cas', 'cas:user', $userOrGroup->getId()));
         }
         foreach ($userOrGroup->getAttributeKeys() as $attribute) {
             foreach ($userOrGroup->getAttributeValues($attribute) as $value) {
                 $attraElem = $elem->appendChild($this->doc->createElementNS('http://www.yale.edu/tp/cas', 'cas:attribute'));
                 $attraElem->setAttribute('name', $attribute);
                 $attraElem->setAttribute('value', $value);
             }
         }
     } catch (OperationFailedException $e) {
         print_r($userOrGroup);
         throw $e;
     }
 }