-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
1,686 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| ``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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/" | ||
| } | ||
| } | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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', | ||
| ]); | ||
| } | ||
| ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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> |
71 changes: 71 additions & 0 deletions
71
app/plugins/OrcidSource/resources/locales/en_US/orcid_source.po
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| # 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 "Public" | ||
|
|
||
| msgid "enumeration.OrcidSourceApiEnum.PUB" | ||
| msgstr "Members" | ||
|
|
||
| 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 "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 "information.orcid_source.linked" | ||
| msgstr "Obtained ORCID {0} via authenticated OAuth flow" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| { | ||
| } |
68 changes: 68 additions & 0 deletions
68
app/plugins/OrcidSource/src/Controller/OrcidSourcesController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| <?php | ||
| /** | ||
| * COmanage Registry Env Sources Controller | ||
| * | ||
| * 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.1.0 | ||
| * @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) | ||
| */ | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace OrcidSource\Controller; | ||
|
|
||
| use App\Controller\StandardPluginController; | ||
| use Cake\Event\EventInterface; | ||
| use Cake\Http\Response; | ||
|
|
||
| class OrcidSourcesController extends StandardPluginController { | ||
| public $paginate = [ | ||
| 'order' => [ | ||
| 'EnvSources.id' => 'asc' | ||
| ] | ||
| ]; | ||
|
|
||
| /** | ||
| * Callback run prior to the request render. | ||
| * | ||
| * @param EventInterface $event Cake Event | ||
| * | ||
| * @return Response|void | ||
| * @since COmanage Registry v5.2.0 | ||
| */ | ||
|
|
||
| public function beforeRender(EventInterface $event) { | ||
| $link = $this->getPrimaryLink(true); | ||
|
|
||
| if(!empty($link->value)) { | ||
| $this->set('vv_bc_parent_obj', $this->OrcidSources->ExternalIdentitySources->get($link->value)); | ||
| $this->set('vv_bc_parent_displayfield', $this->OrcidSources->ExternalIdentitySources->getDisplayField()); | ||
| $this->set('vv_bc_parent_primarykey', $this->OrcidSources->ExternalIdentitySources->getPrimaryKey()); | ||
| } | ||
| $this->set('vv_redirect_uri', $this->OrcidSources->redirectUri()); | ||
|
|
||
| return parent::beforeRender($event); | ||
| } | ||
|
|
||
| public function callback() { | ||
| // dummy | ||
| } | ||
| } |
38 changes: 38 additions & 0 deletions
38
app/plugins/OrcidSource/src/Lib/Enum/OrcidSourceApiEnum.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| <?php | ||
| /** | ||
| * COmanage Registry Orcid Source Api Enum | ||
| * | ||
| * 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) | ||
| */ | ||
|
|
||
| declare(strict_types = 1); | ||
|
|
||
| namespace OrcidSource\Lib\Enum; | ||
|
|
||
| use App\Lib\Enum\StandardEnum; | ||
|
|
||
| class OrcidSourceApiEnum extends StandardEnum { | ||
| const AUTH = 'AUT'; | ||
| const MEMBERS = 'MEM'; | ||
| const PUBLIC = 'PUB'; | ||
| } |
36 changes: 36 additions & 0 deletions
36
app/plugins/OrcidSource/src/Lib/Enum/OrcidSourceScopeEnum.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| <?php | ||
| /** | ||
| * COmanage Registry Orcid Source Scope Enum | ||
| * | ||
| * 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) | ||
| */ | ||
|
|
||
| declare(strict_types = 1); | ||
|
|
||
| namespace OrcidSource\Lib\Enum; | ||
|
|
||
| use App\Lib\Enum\StandardEnum; | ||
|
|
||
| class OrcidSourceScopeEnum extends StandardEnum { | ||
| const DEFAULT_SCOPE = '/authenticate'; | ||
| } |
37 changes: 37 additions & 0 deletions
37
app/plugins/OrcidSource/src/Lib/Enum/OrcidSourceTierEnum.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| <?php | ||
| /** | ||
| * COmanage Registry Orcid Source Tier Enum | ||
| * | ||
| * 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) | ||
| */ | ||
|
|
||
| declare(strict_types = 1); | ||
|
|
||
| namespace OrcidSource\Lib\Enum; | ||
|
|
||
| use App\Lib\Enum\StandardEnum; | ||
|
|
||
| class OrcidSourceTierEnum extends StandardEnum { | ||
| const PROD = 'PRO'; | ||
| const SANDBOX = 'SBX'; | ||
| } |
Oops, something went wrong.