Ejemplo n.º 1
0
 /**
  *
  * Insert/Update an AuthIdsType on the database
  * @param AuthIdsType $bucket
  * @throws Exception
  */
 public function setAuthIdsType($policyId, AuthIdsType &$bucket, $insertMode = FALSE)
 {
     $method = "PUT";
     $url = E3_PROV_URL_POLICY . "/" . rawurlencode($policyId) . "/quotaRLBuckets/" . rawurlencode($bucket->getId());
     if ($insertMode) {
         $method = "POST";
         $url = E3_PROV_URL_POLICY . "/" . rawurlencode($policyId) . "/quotaRLBuckets/";
     }
     /**
      * Send the XML payload the the Provisioning Backend
      */
     $restClient = new RestClient();
     $reply = $restClient->makeCall($url, $method, $bucket->toXML());
     if ($insertMode) {
         $bucket = new AuthIdsType();
         if ($bucket->getId() == NULL) {
             $xml = simplexml_load_string($reply->getPayload());
             $bucket->setId((string) $xml->id);
         }
     }
 }