Skip to content

CFM-121_ORCID_Source_Plugin #311

Merged
merged 1 commit into from
May 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions app/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
"FileConnector\\": "availableplugins/FileConnector/src/",
"PipelineToolkit\\": "availableplugins/PipelineToolkit/src/",
"SqlConnector\\": "availableplugins/SqlConnector/src/",
"CoreJob\\": "plugins/CoreJob/src/"
"CoreJob\\": "plugins/CoreJob/src/",
"OrcidSource\\": "plugins/OrcidSource/src/"
}
},
"autoload-dev": {
Expand All @@ -54,7 +55,8 @@
"FileConnector\\Test\\": "availableplugins/FileConnector/tests/",
"PipelineToolkit\\Test\\": "availableplugins/PipelineToolkit/tests/",
"SqlConnector\\Test\\": "availableplugins/SqlConnector/tests/",
"CoreJob\\Test\\": "plugins/CoreJob/tests/"
"CoreJob\\Test\\": "plugins/CoreJob/tests/",
"OrcidSource\\Test\\": "plugins/OrcidSource/tests/"
}
},
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public function validationDefault(Validator $validator): Validator {
'provider' => 'table'
]
]);
$validator->allowEmptyString('scope');
$validator->notEmptyString('scope');

$validator->add('refresh_token', [
'content' => [
Expand Down
4 changes: 3 additions & 1 deletion app/plugins/EnvSource/templates/EnvSources/fields.inc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ if($vv_action == 'edit') {
]);
}

print "<h3>" . __d('env_source', 'information.header.map') . "</h3>\n";
// Print a title
$title = __d('env_source', 'information.header.map');
print $this->element('form/h3Inject', compact('title'));

$defaultNames = [
'env_identifier_sourcekey' => 'ENV_SOURCE_KEY',
Expand Down
8 changes: 8 additions & 0 deletions app/plugins/OrcidSource/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/composer.lock
/composer.phar
/phpunit.xml
/.phpunit.result.cache
/phpunit.phar
/config/Migrations/schema-dump-default.lock
/vendor/
/.idea/
11 changes: 11 additions & 0 deletions app/plugins/OrcidSource/README.md
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we commit this file? It doesn't actually apply...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@benno other plugins have this files too. This is why i left it in there. Do we remove them from everywhere?

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# OrcidSource plugin for CakePHP

## Installation

You can install this plugin into your CakePHP application using [composer](https://getcomposer.org).

The recommended way to install composer packages is:

```
composer require your-name-here/orcid-source
```
24 changes: 24 additions & 0 deletions app/plugins/OrcidSource/composer.json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, do we need to commit this file? The name is wrong, the license is wrong, and the autoload paths should have been addressed by the main composer.json mods above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@benno the same as above

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "your-name-here/orcid-source",
"description": "OrcidSource plugin for CakePHP",
"type": "cakephp-plugin",
"license": "MIT",
"require": {
"php": ">=7.2",
"cakephp/cakephp": "4.6.*"
},
"require-dev": {
"phpunit/phpunit": "^8.5 || ^9.3"
},
"autoload": {
"psr-4": {
"OrcidSource\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"OrcidSource\\Test\\": "tests/",
"Cake\\Test\\": "vendor/cakephp/cakephp/tests/"
}
}
}
44 changes: 44 additions & 0 deletions app/plugins/OrcidSource/config/routes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php
/**
* Orcid Source plugin specific routes.
*
* Portions licensed to the University Corporation for Advanced Internet
* Development, Inc. ("UCAID") under one or more contributor license agreements.
* See the NOTICE file distributed with this work for additional information
* regarding copyright ownership.
*
* UCAID licenses this file to you under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @link https://www.internet2.edu/comanage COmanage Project
* @package registry-plugins
* @since COmanage Registry v5.2.0
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/

use Cake\Routing\Route\DashedRoute;

$routes->plugin(
'OrcidSource',
['path' => '/orcid-source/'],
function ($routes) {
$routes->setRouteClass(DashedRoute::class);

$routes->get(
'orcid-sources/callback',
[
'plugin' => 'OrcidSource',
'controller' => 'OrcidSources',
'action' => 'callback',
]);
}
);
30 changes: 30 additions & 0 deletions app/plugins/OrcidSource/phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
colors="true"
processIsolation="false"
stopOnFailure="false"
bootstrap="tests/bootstrap.php"
>
<php>
<ini name="memory_limit" value="-1"/>
<ini name="apc.enable_cli" value="1"/>
</php>

<!-- Add any additional test suites you want to run here -->
<testsuites>
<testsuite name="OrcidSource">
<directory>tests/TestCase/</directory>
</testsuite>
</testsuites>

<!-- Setup fixture extension -->
<extensions>
<extension class="Cake\TestSuite\Fixture\PHPUnitExtension" />
</extensions>

<filter>
<whitelist>
<directory suffix=".php">src/</directory>
</whitelist>
</filter>
</phpunit>
110 changes: 110 additions & 0 deletions app/plugins/OrcidSource/resources/locales/en_US/orcid_source.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# COmanage Registry Localizations (orcid_source domain)
#
# Portions licensed to the University Corporation for Advanced Internet
# Development, Inc. ("UCAID") under one or more contributor license agreements.
# See the NOTICE file distributed with this work for additional information
# regarding copyright ownership.
#
# UCAID licenses this file to you under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# @link https://www.internet2.edu/comanage COmanage Project
# @package registry
# @since COmanage Registry v5.2.0
# @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)

msgid "controller.OrcidSourceCollectors"
msgstr "{0,plural,=1{Orcid Source Collector} other{Orcid Source Collectors}}"

msgid "controller.OrcidSources"
msgstr "{0,plural,=1{Orcid Source} other{Orcid Sources}}"

msgid "controller.PetitionOrcidIdentities"
msgstr "{0,plural,=1{Petition Orcid Identity} other{Petition Orcid Identities}}"

msgid "enumeration.OrcidSourceTierEnum.PRO"
msgstr "Production"

msgid "enumeration.OrcidSourceTierEnum.SBX"
msgstr "Sandbox"

msgid "enumeration.OrcidSourceApiEnum.AUT"
msgstr "Authorize"

msgid "enumeration.OrcidSourceApiEnum.MEM"
msgstr "Members"

msgid "enumeration.OrcidSourceApiEnum.PUB"
msgstr "Public"

msgid "error.search"
msgstr "Search request returned {0}"

msgid "error.token.none"
msgstr "Access token not configured (try resaving configuration)"

msgid "error.param.notfound"
msgstr "{0} was not found"

msgid "error.orcid_source.no_orcid"
Ioannis marked this conversation as resolved.
Show resolved Hide resolved
msgstr "ORCID identifier missing from response."

msgid "field.OrcidSources.api_type"
msgstr "API Type"

msgid "field.OrcidSources.redirect_uri"
msgstr "Additional ORCID Redirect URI"

msgid "field.OrcidSources.scope_inherit"
msgstr "Inherit Scope"

msgid "field.OrcidSources.api_tier"
msgstr "API Tier"

msgid "field.OrcidSources.name_type_id"
msgstr "Name Type"

msgid "field.OrcidSources.telephone_number_type_id"
msgstr "Telephone Number Type"

msgid "field.OrcidSources.address_type_id"
msgstr "Address Type"

msgid "field.OrcidSources.default_affiliation_type_id"
msgstr "Default Affiliation Type"

msgid "field.OrcidSources.email_address_type_id"
msgstr "Email Address Type"

msgid "information.OrcidSources.linked"
msgstr "Obtained ORCID {0} via authenticated OAuth flow"

msgid "information.orcid_source.identifier"
msgstr "ORCID Identifier"

msgid "information.OrcidSourceCollectors.authenticate"
msgstr "Authenticate with ORCID"

msgid "information.OrcidSourceCollectors.sign_in"
msgstr "Sign in with your ORCID account to securely verify your ORCID iD."

msgid "information.OrcidSources.default.types"
msgstr "Select Default Types for ORCID Fields"

msgid "result.OrcidSourceCollector.collected"
msgstr "Obtained ORCID Identifier {0}"

msgid "result.orcid.saved"
msgstr "ORCID Token recorded"

msgid "result.pipeline.status"
msgstr "Pipeline completed with status {0}"
10 changes: 10 additions & 0 deletions app/plugins/OrcidSource/src/Controller/AppController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php
declare(strict_types=1);

namespace OrcidSource\Controller;

use App\Controller\AppController as BaseController;

class AppController extends BaseController
{
}
Loading