Skip to content

Commit

Permalink
#10856 OrcidManager functionality failing pre-ORCID setup
Browse files Browse the repository at this point in the history
  • Loading branch information
ewhanson committed Jan 30, 2025
1 parent 59e6479 commit 80ca552
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 0 deletions.
5 changes: 5 additions & 0 deletions classes/orcid/actions/AuthorizeUserData.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ public function __construct(
public function execute(): void
{
$context = $this->request->getContext();

if (!OrcidManager::isEnabled($context)) {
return;
}

$httpClient = Application::get()->getHttpClient();

$errorMessages = [];
Expand Down
4 changes: 4 additions & 0 deletions classes/orcid/actions/PKPSendSubmissionToOrcid.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ public function __construct(
*/
public function execute(): void
{
if (!OrcidManager::isEnabled($this->context)) {
return;
}

if (!OrcidManager::isMemberApiEnabled($this->context) || $this->canDepositSubmission() === false) {
// Sending to ORCID only works with the member API
// FIXME: OMP cannot deposit submissions currently. Check can be removed once added
Expand Down
3 changes: 3 additions & 0 deletions classes/orcid/actions/VerifyAuthorWithOrcid.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ public function __construct(
public function execute(): self
{
$context = $this->request->getContext();
if (!OrcidManager::isEnabled($context)) {
return $this;
}

// Fetch the access token
$oauthTokenUrl = OrcidManager::getApiPath($context) . OrcidManager::OAUTH_TOKEN_URL;
Expand Down
4 changes: 4 additions & 0 deletions jobs/orcid/DepositOrcidSubmission.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ public function handle(): void
return;
}

if (!OrcidManager::isEnabled($this->context)) {
return;
}

$uri = OrcidManager::getApiPath($this->context) . OrcidManager::ORCID_API_VERSION_URL . $this->authorOrcid . '/' . OrcidManager::ORCID_WORK_URL;
$method = 'POST';

Expand Down
4 changes: 4 additions & 0 deletions jobs/orcid/RevokeOrcidToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ public function __construct(
*/
public function handle(): void
{
if (!OrcidManager::isEnabled($this->context)) {
return;
}

$token = $this->identity->getData('orcidAccessToken');
$httpClient = Application::get()->getHttpClient();
$headers = ['Accept' => 'application/json'];
Expand Down
4 changes: 4 additions & 0 deletions jobs/orcid/SendAuthorMail.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ public function handle()
throw new \Exception('Author ORCID emails should only be sent from a Context, never site-wide');
}

if (!OrcidManager::isEnabled($this->context)) {
return;
}

$contextId = $this->context->getId();
$publicationId = $this->author->getData('publicationId');
$publication = Repo::publication()->get($publicationId);
Expand Down

0 comments on commit 80ca552

Please sign in to comment.