Merge branch 'master' of https://github.com/alchemy-fr/Phraseanet into PHRAS-2375-port41-preview-pdf-on-pdfjs

This commit is contained in:
aina-esokia
2019-01-25 15:13:00 +04:00
33 changed files with 197 additions and 73 deletions

View File

@@ -537,7 +537,11 @@ class API_OAuth2_Adapter extends OAuth2
public function verifyAccessToken($scope = null, $exit_not_present = true, $exit_invalid = true, $exit_expired = true, $exit_scope = true, $realm = null)
{
$token_param = $this->getAccessTokenParams();
$apiTokenHeader = $this->app['conf']->get(['main', 'api_token_header']);
$useTokenHeader = $this->useTokenHeaderChoice($apiTokenHeader);
$token_param = $this->getAccessTokenParams($useTokenHeader);
// Access token was not provided
if ($token_param === false) {
@@ -808,4 +812,21 @@ class API_OAuth2_Adapter extends OAuth2
return false;
}
}
/**
* Get the correct constante to call on Oauth2
*
* @param $apiTokenHeader
* @return string
*/
private function useTokenHeaderChoice($apiTokenHeader)
{
if ($apiTokenHeader === true) {
return Oauth2::TOKEN_ONLY_IN_HEADER;
} elseif ($apiTokenHeader === false) {
return Oauth2::TOKEN_ONLY_IN_GETPOST;
} else {
return Oauth2::TOKEN_AUTO_FIND;
}
}
}

View File

@@ -446,7 +446,6 @@ class databox extends base implements ThumbnailedElement
databox_field::TYPE_DATE
, databox_field::TYPE_NUMBER
, databox_field::TYPE_STRING
, databox_field::TYPE_TEXT
]
) ? $type : databox_field::TYPE_STRING;

View File

@@ -100,7 +100,6 @@ class databox_field implements cache_cacheableInterface
protected $original_dces;
protected $aggregable;
const TYPE_TEXT = "text";
const TYPE_DATE = "date";
const TYPE_STRING = "string";
const TYPE_NUMBER = "number";

View File

@@ -0,0 +1,64 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2016 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Alchemy\Phrasea\Application;
class patch_410alpha14a implements patchInterface
{
/** @var string */
private $release = '4.1.0-alpha.14a';
/** @var array */
private $concern = [base::DATA_BOX];
/**
* {@inheritdoc}
*/
public function get_release()
{
return $this->release;
}
/**
* {@inheritdoc}
*/
public function getDoctrineMigrations()
{
return [];
}
/**
* {@inheritdoc}
*/
public function require_all_upgrades()
{
return false;
}
/**
* {@inheritdoc}
*/
public function concern()
{
return $this->concern;
}
/**
* {@inheritdoc}
*/
public function apply(base $databox, Application $app)
{
$sql = "UPDATE metadatas_structure SET type = 'string' where type = 'text' OR type = '' ";
$databox->get_connection()->executeQuery($sql);
return true;
}
}