Skip to content

Commit

Permalink
#42 #105 CallerId is broken
Browse files Browse the repository at this point in the history
  • Loading branch information
avarapai committed Aug 27, 2024
1 parent 2458c92 commit 96cd10d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/WebAPI/OData/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,11 @@ private function doRequest( string $method, string $url, $data = null, array $he
$headers = array_merge( [ 'Content-Type' => 'application/json' ], $headers );
}

if ( $this->settings->callerID !== null ) {
$headers = array_merge( [ 'MSCRMCallerID' => '$this->settings->callerID' ], $headers );
if ( $this->settings->callerObjectId !== null ) {
$headers = array_merge( [ 'CallerObjectId' => $this->settings->callerObjectId ], $headers );
}
elseif ( $this->settings->callerID !== null ) {
$headers = array_merge( [ 'MSCRMCallerID' => $this->settings->callerID ], $headers );
}

try {
Expand Down
11 changes: 9 additions & 2 deletions src/WebAPI/OData/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,19 @@ abstract class Settings implements LoggerAwareInterface {
public LoggerInterface $logger;

/**
* ID of the user to impersonate during calls.
*
* ID of the user (systemuserid) to impersonate during calls.
* @deprecated
* Null value means impersonation is not performed.
*/
public ?string $callerID = null;

/**
* Microsoft Entra ID object ID - azureactivedirectoryobjectid
*
* Null value means impersonation is not performed.
*/
public ?string $callerObjectId = null;

/**
* Settings constructor.
*/
Expand Down

0 comments on commit 96cd10d

Please sign in to comment.