Skip to content
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

No gemini #45

Merged
merged 4 commits into from
Mar 12, 2021
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
1,303 changes: 1,052 additions & 251 deletions composer.lock

Large diffs are not rendered by default.

235 changes: 0 additions & 235 deletions src/Client/GeminiClient.php

This file was deleted.

37 changes: 37 additions & 0 deletions src/EntityMapper/EntityMapper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

namespace Islandora\Crayfish\Commons\EntityMapper;

class EntityMapper implements EntityMapperInterface
{
/**
* {@inheritdoc}
*/
public function getFedoraPath($uuid)
{
if (strlen($uuid) < 8) {
throw new \InvalidArgumentException(
"Provided UUID must be at least of length 8 to account for pair-trees",
400
);
}

$segments = str_split(substr($uuid, 0, 8), 2);
return implode("/", $segments) . "/$uuid";
}

/**
* {@inheritdoc}
*/
public function getDrupalUuid($fedora_path)
{
if (empty($fedora_path)) {
throw new \InvalidArgumentException(
"Empty string provided fedora path",
400
);
}
$segments = explode("/", $fedora_path);
return end($segments);
}
}
22 changes: 22 additions & 0 deletions src/EntityMapper/EntityMapperInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace Islandora\Crayfish\Commons\EntityMapper;

interface EntityMapperInterface
{
/**
* Gets a fedora path given a uuid.
*
* @param string $uuid
* @return string
*/
public function getFedoraPath($uuid);

/**
* Gets a drupal uuid from a fedora path.
*
* @param string $fedora_path
* @return string
*/
public function getDrupalUuid($fedora_path);
}
25 changes: 0 additions & 25 deletions src/Provider/IslandoraServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ public function register(Container $container)
}
};

$this->registerDbOptions($container);

// Register our services
$container['crayfish.cmd_execute_service'] = function ($container) {
return new CmdExecuteService(
Expand Down Expand Up @@ -93,27 +91,4 @@ public function register(Container $container)
);
};
}

protected function registerDbOptions($container)
{
$container['db.options'] = function ($container) {
$match = "crayfish.db.options.";
$set_option = function (&$settings, $container, $key) use ($match) {
$name = substr($key, strlen($match));
if (isset($container[$key])) {
$settings[$name] = $container[$key];
}
};

$settings = [];
$keys = $container->keys();
foreach ($keys as $key) {
if (strpos($key, $match) === 0) {
$set_option($settings, $container, $key);
}
}

return $settings;
};
}
}
5 changes: 5 additions & 0 deletions src/Syn/JwtAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ public function __construct(
$this->sites = $parser->getSites();
}

public function supports(Request $request)
{
return $request->headers->has('Authorization');
}

public function getCredentials(Request $request)
{
// Check headers
Expand Down
Loading