-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make Crayfish-Commons a Symfony bundle only. #49
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
05bfcc0
Change to symfony/flex
whikloj c4bbb7d
Coder
whikloj 184b2f5
Correct namespace for tests (#39)
whikloj 88cca36
Finalize Crayfish-Commons in Symfony 4.4
whikloj 92a31d7
Don't fail if no Apix-Ldp-Resource header
whikloj b17d19e
Remove check for master request
whikloj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -1,2 +1,4 @@ | ||
.idea | ||
vendor | ||
.phpunit* | ||
clover.xml |
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
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
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,9 @@ | ||
<?php | ||
|
||
namespace Islandora\Crayfish\Commons; | ||
|
||
use Symfony\Component\HttpKernel\Bundle\Bundle; | ||
|
||
class CrayfishCommonsBundle extends Bundle | ||
{ | ||
} |
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,26 @@ | ||
<?php | ||
|
||
namespace Islandora\Crayfish\Commons\DependencyInjection; | ||
|
||
use Symfony\Component\Config\Definition\Builder\TreeBuilder; | ||
use Symfony\Component\Config\Definition\ConfigurationInterface; | ||
|
||
class Configuration implements ConfigurationInterface | ||
{ | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getConfigTreeBuilder() | ||
{ | ||
$treeBuilder = new TreeBuilder('crayfish_commons'); | ||
$root = $treeBuilder->getRootNode(); | ||
$root->addDefaultsIfNotSet() | ||
->children() | ||
->scalarNode('fedora_base_uri')->cannotBeEmpty()->defaultValue('http://localhost:8080/fcrepo/rest')->end() | ||
->scalarNode('syn_config')->defaultValue(__DIR__ . '/../Resources/default_syn.xml')->end() | ||
->end(); | ||
|
||
return $treeBuilder; | ||
} | ||
} |
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,64 @@ | ||
<?php | ||
|
||
namespace Islandora\Crayfish\Commons\DependencyInjection; | ||
|
||
use Islandora\Chullo\IFedoraApi; | ||
use Islandora\Crayfish\Commons\Client\GeminiClient; | ||
use Islandora\Crayfish\Commons\CmdExecuteService; | ||
use Islandora\Crayfish\Commons\EntityMapper\EntityMapper; | ||
use Islandora\Crayfish\Commons\Syn\JwtAuthenticator; | ||
use Islandora\Crayfish\Commons\Syn\JwtFactory; | ||
use Islandora\Crayfish\Commons\Syn\JwtUserProvider; | ||
use Islandora\Crayfish\Commons\Syn\SettingsParser; | ||
use Symfony\Component\Config\FileLocator; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; | ||
use Symfony\Component\Filesystem\Exception\IOException; | ||
use Symfony\Component\HttpKernel\DependencyInjection\Extension; | ||
|
||
class CrayfishCommonsExtension extends Extension | ||
{ | ||
|
||
public function load(array $configs, ContainerBuilder $container) | ||
{ | ||
$configuration = new Configuration(); | ||
|
||
$config = $this->processConfiguration($configuration, $configs); | ||
|
||
$loader = new YamlFileLoader( | ||
$container, | ||
new FileLocator(realpath(__DIR__ . '/../Resources/config')) | ||
); | ||
$loader->load('crayfish_commons.yaml'); | ||
|
||
if (!$container->has('Islandora\Crayfish\Commons\Syn\SettingsParser')) { | ||
if (file_exists($config['syn_config'])) { | ||
$xml = file_get_contents($config['syn_config']); | ||
} | ||
else { | ||
throw new IOException("Security configuration not found. ${config['syn_config']}"); | ||
} | ||
|
||
$container->register('Islandora\Crayfish\Commons\Syn\SettingsParser', SettingsParser::class) | ||
->setArgument('$xml', $xml); | ||
} | ||
|
||
if (!$container->has('Islandora\Crayfish\Commons\Syn\JwtUserProvider')) { | ||
$container->register('Islandora\Crayfish\Commons\Syn\JwtUserProvider', JwtUserProvider::class); | ||
} | ||
if (!$container->has('Islandora\Crayfish\Commons\Syn\JwtFactory')) { | ||
$container->register('Islandora\Crayfish\Commons\Syn\JwtFactory', JwtFactory::class); | ||
} | ||
if (!$container->has('Islandora\Crayfish\Commons\Syn\JwtAuthenticator')) { | ||
$container->register('Islandora\Crayfish\Commons\Syn\JwtAuthenticator', JwtAuthenticator::class) | ||
->setAutowired(true); | ||
} | ||
|
||
if (!$container->has('Islandora\Chullo\IFedoraApi')) { | ||
$container->register('Islandora\Chullo\IFedoraApi', IFedoraApi::class) | ||
->setFactory('Islandora\Chullo\FedoraApi::create') | ||
->setArgument('$fedora_rest_url', $config['fedora_base_uri']); | ||
$container->setAlias('Islandora\Chullo\FedoraApi', 'Islandora\Chullo\IFedoraApi'); | ||
} | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
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,25 @@ | ||
|
||
services: | ||
_defaults: | ||
autowire: true | ||
autoconfigure: true | ||
public: true | ||
|
||
# These services rely on expected container available DI injections. | ||
# Other services are loaded in the CrayfishCommonsExtension class. | ||
Islandora\Crayfish\Commons\CmdExecuteService: ~ | ||
|
||
Islandora\Crayfish\Commons\EntityMapper\: | ||
resource: '../../EntityMapper/*' | ||
|
||
Islandora\Crayfish\Commons\ApixMiddleware: | ||
tags: | ||
- { name: kernel.event_subscriber, event: kernel.request } | ||
|
||
# Aliases, if the class has not yet been instantiated it will be | ||
# in CrayfishCommonsExtension class | ||
crayfish.cmd_execute_service: | ||
alias: Islandora\Crayfish\Commons\CmdExecuteService | ||
|
||
# Map the concrete class to the interface. | ||
Islandora\Crayfish\Commons\EntityMapper\EntityMapperInterface: '@Islandora\Crayfish\Commons\EntityMapper\EntityMapper' |
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,4 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- Default Config --> | ||
<config version='1'> | ||
</config> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In poking around and running tests, I found that the we broke the tests here, where it tests for the 400 error being emitted... easy enough fix just setting the response with something like:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking to address in #57