Skip to content

Commit

Permalink
Review comments fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ioannis committed Aug 5, 2025
1 parent 7c37dcb commit 0873cc0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
10 changes: 2 additions & 8 deletions app/plugins/OrcidSource/src/Controller/ApiV2Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,10 @@ public function get(string $orcid, int $coId) {
$orcidSourcesRecords = $this->OrcidSources
->find()
->contain([
'Servers.Oauth2Servers' => function ($q) {
return $q->where(["LOWER(Oauth2Servers.url) LIKE" => '%orcid%']);
},
'Servers',
'ExternalIdentitySources',
])
->innerJoinWith('Servers.Oauth2Servers', function ($q) {
return $q->where([
"LOWER(Oauth2Servers.url) LIKE" => '%orcid%'
]);
})
->innerJoinWith('Servers')
->innerJoinWith('ExternalIdentitySources')
->where([
'Servers.plugin' => 'CoreServer.Oauth2Servers',
Expand Down
14 changes: 4 additions & 10 deletions app/plugins/OrcidSource/src/Model/Table/OrcidSourcesTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -517,28 +517,22 @@ protected function orcidConnect(
): \Cake\Http\Client {
$this->orcidSource = $this->find()
->contain([
'Servers.Oauth2Servers' => function ($q) {
return $q->where(["LOWER(Oauth2Servers.url) LIKE" => '%orcid%']);
},
'Servers' => ['Oauth2Servers'],
'ExternalIdentitySources',
])
->innerJoinWith('Servers.Oauth2Servers', function ($q) {
return $q->where([
"LOWER(Oauth2Servers.url) LIKE" => '%orcid%'
]);
})
->innerJoinWith('Servers.Oauth2Servers')
->innerJoinWith('ExternalIdentitySources')
->where([
'Servers.plugin' => 'CoreServer.Oauth2Servers',
'ExternalIdentitySources.id' => $exterrnalIdentitySource->id,
'ExternalIdentitySources.plugin' => 'OrcidSource.OrcidSources'
'ExternalIdentitySources.plugin' => 'OrcidSource.OrcidSources',
])
->first();

// Set the CO ID
$this->setCurCoId($this->orcidSource->server->co_id);

if ( empty($this->orcidSource->id)) {
if (empty($this->orcidSource->id)) {
throw new \InvalidArgumentException(__d('error', 'notfound', [__d('core_server', 'controller.Oauth2Servers')]));
}

Expand Down

0 comments on commit 0873cc0

Please sign in to comment.