Skip to content

Commit 80ca552

Browse files
committed
#10856 OrcidManager functionality failing pre-ORCID setup
1 parent 59e6479 commit 80ca552

File tree

6 files changed

+24
-0
lines changed

6 files changed

+24
-0
lines changed

classes/orcid/actions/AuthorizeUserData.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ public function __construct(
3535
public function execute(): void
3636
{
3737
$context = $this->request->getContext();
38+
39+
if (!OrcidManager::isEnabled($context)) {
40+
return;
41+
}
42+
3843
$httpClient = Application::get()->getHttpClient();
3944

4045
$errorMessages = [];

classes/orcid/actions/PKPSendSubmissionToOrcid.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ public function __construct(
3737
*/
3838
public function execute(): void
3939
{
40+
if (!OrcidManager::isEnabled($this->context)) {
41+
return;
42+
}
43+
4044
if (!OrcidManager::isMemberApiEnabled($this->context) || $this->canDepositSubmission() === false) {
4145
// Sending to ORCID only works with the member API
4246
// FIXME: OMP cannot deposit submissions currently. Check can be removed once added

classes/orcid/actions/VerifyAuthorWithOrcid.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ public function __construct(
4242
public function execute(): self
4343
{
4444
$context = $this->request->getContext();
45+
if (!OrcidManager::isEnabled($context)) {
46+
return $this;
47+
}
4548

4649
// Fetch the access token
4750
$oauthTokenUrl = OrcidManager::getApiPath($context) . OrcidManager::OAUTH_TOKEN_URL;

jobs/orcid/DepositOrcidSubmission.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ public function handle(): void
4747
return;
4848
}
4949

50+
if (!OrcidManager::isEnabled($this->context)) {
51+
return;
52+
}
53+
5054
$uri = OrcidManager::getApiPath($this->context) . OrcidManager::ORCID_API_VERSION_URL . $this->authorOrcid . '/' . OrcidManager::ORCID_WORK_URL;
5155
$method = 'POST';
5256

jobs/orcid/RevokeOrcidToken.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ public function __construct(
3838
*/
3939
public function handle(): void
4040
{
41+
if (!OrcidManager::isEnabled($this->context)) {
42+
return;
43+
}
44+
4145
$token = $this->identity->getData('orcidAccessToken');
4246
$httpClient = Application::get()->getHttpClient();
4347
$headers = ['Accept' => 'application/json'];

jobs/orcid/SendAuthorMail.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ public function handle()
4444
throw new \Exception('Author ORCID emails should only be sent from a Context, never site-wide');
4545
}
4646

47+
if (!OrcidManager::isEnabled($this->context)) {
48+
return;
49+
}
50+
4751
$contextId = $this->context->getId();
4852
$publicationId = $this->author->getData('publicationId');
4953
$publication = Repo::publication()->get($publicationId);

0 commit comments

Comments
 (0)