PHRAS-3253 user authentication via auth service

This commit is contained in:
aina esokia
2020-11-03 14:38:09 +03:00
parent f5c64d2da3
commit 695b13328f
20 changed files with 2280 additions and 1221 deletions

View File

@@ -9465,7 +9465,7 @@ var workzone = function workzone(services) {
});
(0, _jquery2.default)('.add_publication').on('click', function (event) {
openExposePublicationAdd();
openExposePublicationAdd((0, _jquery2.default)('#expose_list').val());
});
(0, _jquery2.default)('.refresh-list').on('click', function (event) {
@@ -10268,7 +10268,7 @@ var workzone = function workzone(services) {
});
}
function openExposePublicationAdd() {
function openExposePublicationAdd(exposeName) {
(0, _jquery2.default)('#DIALOG-expose-add').attr('title', localeService.t('Edit expose title')).dialog({
autoOpen: false,
closeOnEscape: true,
@@ -10287,6 +10287,30 @@ var workzone = function workzone(services) {
(0, _jquery2.default)('#DIALOG-expose-add').on('click', '.close-expose-modal', function () {
(0, _jquery2.default)('#DIALOG-expose-add').dialog('close');
});
_jquery2.default.ajax({
type: "GET",
url: '/prod/expose/list-publication/?format=json&exposeName=' + exposeName,
success: function success(data) {
(0, _jquery2.default)('#DIALOG-expose-add #publication_parent').empty().html('<option value="">Select a parent publication</option>');
var i = 0;
for (; i < data.publications.length; i++) {
(0, _jquery2.default)('#DIALOG-expose-add select#publication_parent').append('<option value=' + data.publications[i].id + ' >' + data.publications[i].title + '</option>');
}
}
});
_jquery2.default.ajax({
type: "GET",
url: '/prod/expose/list-profile?exposeName=' + exposeName,
success: function success(data) {
(0, _jquery2.default)('#DIALOG-expose-add select#profile-field').empty().html('<option value="">Select Profile</option>');;
var i = 0;
for (; i < data.profiles.length; i++) {
(0, _jquery2.default)('select#profile-field').append('<option ' + 'value=' + data.basePath + '/' + data.profiles[i].id + ' >' + data.profiles[i].name + '</option>');
}
}
});
}
function openExposePublicationEdit(edit) {

View File

@@ -9465,7 +9465,7 @@ var workzone = function workzone(services) {
});
(0, _jquery2.default)('.add_publication').on('click', function (event) {
openExposePublicationAdd();
openExposePublicationAdd((0, _jquery2.default)('#expose_list').val());
});
(0, _jquery2.default)('.refresh-list').on('click', function (event) {
@@ -10268,7 +10268,7 @@ var workzone = function workzone(services) {
});
}
function openExposePublicationAdd() {
function openExposePublicationAdd(exposeName) {
(0, _jquery2.default)('#DIALOG-expose-add').attr('title', localeService.t('Edit expose title')).dialog({
autoOpen: false,
closeOnEscape: true,
@@ -10287,6 +10287,30 @@ var workzone = function workzone(services) {
(0, _jquery2.default)('#DIALOG-expose-add').on('click', '.close-expose-modal', function () {
(0, _jquery2.default)('#DIALOG-expose-add').dialog('close');
});
_jquery2.default.ajax({
type: "GET",
url: '/prod/expose/list-publication/?format=json&exposeName=' + exposeName,
success: function success(data) {
(0, _jquery2.default)('#DIALOG-expose-add #publication_parent').empty().html('<option value="">Select a parent publication</option>');
var i = 0;
for (; i < data.publications.length; i++) {
(0, _jquery2.default)('#DIALOG-expose-add select#publication_parent').append('<option value=' + data.publications[i].id + ' >' + data.publications[i].title + '</option>');
}
}
});
_jquery2.default.ajax({
type: "GET",
url: '/prod/expose/list-profile?exposeName=' + exposeName,
success: function success(data) {
(0, _jquery2.default)('#DIALOG-expose-add select#profile-field').empty().html('<option value="">Select Profile</option>');;
var i = 0;
for (; i < data.profiles.length; i++) {
(0, _jquery2.default)('select#profile-field').append('<option ' + 'value=' + data.basePath + '/' + data.profiles[i].id + ' >' + data.profiles[i].name + '</option>');
}
}
});
}
function openExposePublicationEdit(edit) {

View File

@@ -91,7 +91,7 @@ const workzone = (services) => {
});
$('.add_publication').on('click',function (event) {
openExposePublicationAdd();
openExposePublicationAdd($('#expose_list').val());
});
$('.refresh-list').on('click',function (event) {
@@ -905,7 +905,7 @@ const workzone = (services) => {
});
}
function openExposePublicationAdd() {
function openExposePublicationAdd(exposeName) {
$('#DIALOG-expose-add').attr('title', localeService.t('Edit expose title'))
.dialog({
autoOpen: false,
@@ -926,6 +926,34 @@ const workzone = (services) => {
$('#DIALOG-expose-add').on('click', '.close-expose-modal', function () {
$('#DIALOG-expose-add').dialog('close');
});
$.ajax({
type: "GET",
url: `/prod/expose/list-publication/?format=json&exposeName=` + exposeName,
success: function (data) {
$('#DIALOG-expose-add #publication_parent').empty().html('<option value="">Select a parent publication</option>');
var i = 0;
for ( ;i < data.publications.length; i++) {
$('#DIALOG-expose-add select#publication_parent').append('<option value='+data.publications[i].id+' >'+data.publications[i].title+'</option>');
}
}
});
$.ajax({
type: "GET",
url: `/prod/expose/list-profile?exposeName=` + exposeName,
success: function (data) {
$('#DIALOG-expose-add select#profile-field').empty().html('<option value="">Select Profile</option>');;
var i = 0;
for (; i < data.profiles.length; i++) {
$('select#profile-field').append('<option ' +
'value=' + data.basePath + '/' + data.profiles[i].id + ' >'
+ data.profiles[i].name +
'</option>'
);
}
}
});
}
function openExposePublicationEdit(edit) {

View File

@@ -4,15 +4,70 @@ namespace Alchemy\Phrasea\PhraseanetService\Controller;
use Alchemy\Phrasea\Application as PhraseaApplication;
use Alchemy\Phrasea\Controller\Controller;
use Alchemy\Phrasea\Controller\RecordsRequest;
use Alchemy\Phrasea\WorkerManager\Event\ExposeUploadEvent;
use Alchemy\Phrasea\WorkerManager\Event\WorkerEvents;
use GuzzleHttp\Client;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Session\Session;
class PSExposeController extends Controller
{
/**
* Set access token on session 'password_access_token'
* @param PhraseaApplication $app
* @param Request $request
* @return \Symfony\Component\HttpFoundation\JsonResponse
*/
public function authenticateAction(PhraseaApplication $app, Request $request)
{
$exposeConfiguration = $app['conf']->get(['phraseanet-service', 'expose-service', 'exposes'], []);
$exposeConfiguration = $exposeConfiguration[$request->request->get('exposeName')];
if ($exposeConfiguration == null) {
return $this->app->json([
'success' => false,
'message' => 'Please, set configuration in admin!'
]);
}
$oauthClient = new Client(['base_uri' => $exposeConfiguration['auth_base_uri'], 'http_errors' => false]);
try {
$response = $oauthClient->post('/oauth/v2/token', [
'json' => [
'client_id' => $exposeConfiguration['auth_client_id'],
'client_secret' => $exposeConfiguration['auth_client_secret'],
'grant_type' => 'password',
'username' => $request->request->get('auth-username'),
'password' => $request->request->get('auth-password') ]
]);
} catch(\Exception $e) {
return $this->app->json([
'success' => false,
'message' => $e->getMessage()
]);
}
if ($response->getStatusCode() !== 200) {
return $this->app->json([
'success' => false,
'message' => 'Status code: '. $response->getStatusCode()
]);
}
$tokenBody = $response->getBody()->getContents();
$tokenBody = json_decode($tokenBody,true);
$session = $this->getSession();
$session->set('password_access_token', $tokenBody['access_token']);
return $this->app->json([
'success' => true
]);
}
/**
* Get list of publication
* Use param "format=json" to retrieve a json
@@ -32,21 +87,27 @@ class PSExposeController extends Controller
$exposeConfiguration = $app['conf']->get(['phraseanet-service', 'expose-service', 'exposes'], []);
$exposeConfiguration = $exposeConfiguration[$request->get('exposeName')];
$exposeClient = new Client(['base_uri' => $exposeConfiguration['expose_base_uri'], 'http_errors' => false]);
$session = $this->getSession();
if (!isset($exposeConfiguration['token'])) {
$exposeConfiguration = $this->generateAndSaveToken($exposeConfiguration, $request->get('exposeName'));
if (!$session->has('password_access_token') && $exposeConfiguration['connection_kind'] == 'password' && $request->get('format') != 'json') {
return $this->render("prod/WorkZone/ExposeOauthLogin.html.twig", [
'exposeName' => $request->get('exposeName')
]);
}
$accessToken = $this->getAndSaveToken($exposeConfiguration);
if ($exposeConfiguration == null ) {
return $this->render("prod/WorkZone/ExposeList.html.twig", [
'publications' => [],
]);
}
$exposeClient = new Client(['base_uri' => $exposeConfiguration['expose_base_uri'], 'http_errors' => false]);
$response = $exposeClient->get('/publications?flatten=true&order[createdAt]=desc', [
'headers' => [
'Authorization' => 'Bearer '. $exposeConfiguration['token'],
'Authorization' => 'Bearer '. $accessToken,
'Content-Type' => 'application/json'
]
]);
@@ -86,14 +147,12 @@ class PSExposeController extends Controller
$exposeClient = new Client(['base_uri' => $exposeConfiguration['expose_base_uri'], 'http_errors' => false]);
if (!isset($exposeConfiguration['token'])) {
$exposeConfiguration = $this->generateAndSaveToken($exposeConfiguration, $request->get('exposeName'));
}
$accessToken = $this->getAndSaveToken($exposeConfiguration);
$publication = [];
$resPublication = $exposeClient->get('/publications/' . $request->get('publicationId') , [
'headers' => [
'Authorization' => 'Bearer '. $exposeConfiguration['token'],
'Authorization' => 'Bearer '. $accessToken,
'Content-Type' => 'application/json'
]
]);
@@ -139,13 +198,11 @@ class PSExposeController extends Controller
$exposeClient = new Client(['base_uri' => $exposeConfiguration['expose_base_uri'], 'http_errors' => false]);
if (!isset($exposeConfiguration['token'])) {
$exposeConfiguration = $this->generateAndSaveToken($exposeConfiguration, $request->get('exposeName'));
}
$accessToken = $this->getAndSaveToken($exposeConfiguration);
$resPublication = $exposeClient->get('/publications/' . $request->get('publicationId') . '/assets?page=' . $page , [
'headers' => [
'Authorization' => 'Bearer '. $exposeConfiguration['token'],
'Authorization' => 'Bearer '. $accessToken,
'Content-Type' => 'application/json'
]
]);
@@ -194,16 +251,14 @@ class PSExposeController extends Controller
$exposeClient = new Client(['base_uri' => $exposeConfiguration['expose_base_uri'], 'http_errors' => false]);
if (!isset($exposeConfiguration['token'])) {
$exposeConfiguration = $this->generateAndSaveToken($exposeConfiguration, $request->get('exposeName'));
}
$accessToken = $this->getAndSaveToken($exposeConfiguration);
$profiles = [];
$basePath = '';
$resProfile = $exposeClient->get('/publication-profiles' , [
'headers' => [
'Authorization' => 'Bearer '. $exposeConfiguration['token'],
'Authorization' => 'Bearer '. $accessToken,
'Content-Type' => 'application/json'
]
]);
@@ -245,24 +300,20 @@ class PSExposeController extends Controller
]);
}
// TODO: taken account admin config ,acces_token for user or client_credentiels
$exposeConfiguration = $app['conf']->get(['phraseanet-service', 'expose-service', 'exposes'], []);
$exposeConfiguration = $exposeConfiguration[$exposeName];
$exposeClient = new Client(['base_uri' => $exposeConfiguration['expose_base_uri'], 'http_errors' => false]);
try {
if (!isset($exposeConfiguration['token'])) {
$exposeConfiguration = $this->generateAndSaveToken($exposeConfiguration, $exposeName);
}
$accessToken = $this->getAndSaveToken($exposeConfiguration);
$response = $this->postPublication($exposeClient, $exposeConfiguration['token'], json_decode($request->get('publicationData'), true));
$response = $this->postPublication($exposeClient, $accessToken, json_decode($request->get('publicationData'), true));
if ($response->getStatusCode() == 401) {
$exposeConfiguration = $this->generateAndSaveToken($exposeConfiguration, $exposeName);
$accessToken = $this->getAndSaveToken($exposeConfiguration);
$response = $this->postPublication($exposeClient, $exposeConfiguration['token'], json_decode($request->get('publicationData'), true));
$response = $this->postPublication($exposeClient, $accessToken, json_decode($request->get('publicationData'), true));
}
if ($response->getStatusCode() !== 201) {
@@ -304,23 +355,19 @@ class PSExposeController extends Controller
{
$exposeName = $request->get('exposeName');
// TODO: taken account admin config ,acces_token for user or client_credentiels
$exposeConfiguration = $app['conf']->get(['phraseanet-service', 'expose-service', 'exposes'], []);
$exposeConfiguration = $exposeConfiguration[$exposeName];
$exposeClient = new Client(['base_uri' => $exposeConfiguration['expose_base_uri'], 'http_errors' => false]);
try {
if (!isset($exposeConfiguration['token'])) {
$exposeConfiguration = $this->generateAndSaveToken($exposeConfiguration, $exposeName);
}
$accessToken = $this->getAndSaveToken($exposeConfiguration);
$response = $this->putPublication($exposeClient, $request->get('publicationId'), $exposeConfiguration['token'], json_decode($request->get('publicationData'), true));
$response = $this->putPublication($exposeClient, $request->get('publicationId'), $accessToken, json_decode($request->get('publicationData'), true));
if ($response->getStatusCode() == 401) {
$exposeConfiguration = $this->generateAndSaveToken($exposeConfiguration, $exposeName);
$response = $this->putPublication($exposeClient, $request->get('publicationId'), $exposeConfiguration['token'], json_decode($request->get('publicationData'), true));
$accessToken = $this->getAndSaveToken($exposeConfiguration);
$response = $this->putPublication($exposeClient, $request->get('publicationId'), $accessToken, json_decode($request->get('publicationData'), true));
}
if ($response->getStatusCode() !== 200) {
@@ -354,23 +401,19 @@ class PSExposeController extends Controller
{
$exposeName = $request->get('exposeName');
// TODO: taken account admin config ,acces_token for user or client_credentiels
$exposeConfiguration = $app['conf']->get(['phraseanet-service', 'expose-service', 'exposes'], []);
$exposeConfiguration = $exposeConfiguration[$exposeName];
$exposeClient = new Client(['base_uri' => $exposeConfiguration['expose_base_uri'], 'http_errors' => false]);
try {
if (!isset($exposeConfiguration['token'])) {
$exposeConfiguration = $this->generateAndSaveToken($exposeConfiguration, $exposeName);
}
$accessToken = $this->getAndSaveToken($exposeConfiguration);
$response = $this->removePublication($exposeClient, $request->get('publicationId'), $exposeConfiguration['token']);
$response = $this->removePublication($exposeClient, $request->get('publicationId'), $accessToken);
if ($response->getStatusCode() == 401) {
$exposeConfiguration = $this->generateAndSaveToken($exposeConfiguration, $exposeName);
$response = $this->removePublication($exposeClient, $request->get('publicationId'), $exposeConfiguration['token']);
$accessToken = $this->getAndSaveToken($exposeConfiguration);
$response = $this->removePublication($exposeClient, $request->get('publicationId'), $accessToken);
}
if ($response->getStatusCode() !== 204) {
@@ -404,23 +447,19 @@ class PSExposeController extends Controller
{
$exposeName = $request->get('exposeName');
// TODO: taken account admin config ,acces_token for user or client_credentiels
$exposeConfiguration = $app['conf']->get(['phraseanet-service', 'expose-service', 'exposes'], []);
$exposeConfiguration = $exposeConfiguration[$exposeName];
$exposeClient = new Client(['base_uri' => $exposeConfiguration['expose_base_uri'], 'http_errors' => false]);
try {
if (!isset($exposeConfiguration['token'])) {
$exposeConfiguration = $this->generateAndSaveToken($exposeConfiguration, $exposeName);
}
$accessToken = $this->getAndSaveToken($exposeConfiguration);
$response = $this->removeAssetPublication($exposeClient, $request->get('publicationId'), $request->get('assetId'), $exposeConfiguration['token']);
$response = $this->removeAssetPublication($exposeClient, $request->get('publicationId'), $request->get('assetId'), $accessToken);
if ($response->getStatusCode() == 401) {
$exposeConfiguration = $this->generateAndSaveToken($exposeConfiguration, $exposeName);
$response = $this->removeAssetPublication($exposeClient, $request->get('publicationId'), $request->get('assetId'), $exposeConfiguration['token']);
$accessToken = $this->getAndSaveToken($exposeConfiguration);
$response = $this->removeAssetPublication($exposeClient, $request->get('publicationId'), $request->get('assetId'), $accessToken);
}
if ($response->getStatusCode() !== 204) {
@@ -465,7 +504,11 @@ class PSExposeController extends Controller
]);
}
$this->getEventDispatcher()->dispatch(WorkerEvents::EXPOSE_UPLOAD_ASSETS, new ExposeUploadEvent($lst, $exposeName, $publicationId));
$exposeConfiguration = $app['conf']->get(['phraseanet-service', 'expose-service', 'exposes'], []);
$exposeConfiguration = $exposeConfiguration[$exposeName];
$accessToken = $this->getAndSaveToken($exposeConfiguration);
$this->getEventDispatcher()->dispatch(WorkerEvents::EXPOSE_UPLOAD_ASSETS, new ExposeUploadEvent($lst, $exposeName, $publicationId, $accessToken));
return $app->json([
'success' => true,
@@ -474,20 +517,29 @@ class PSExposeController extends Controller
}
/**
* Get Token and save in session
* @param $config
* @param $exposeName
*
* @return mixed
*/
private function generateAndSaveToken($config, $exposeName)
private function getAndSaveToken($config)
{
$session = $this->getSession();
$accessToken = '';
if ($config['connection_kind'] == 'password') {
$accessToken = $session->get('password_access_token');
} elseif ($config['connection_kind'] == 'client_credentials') {
if ($session->has('credential_access_token')) {
$accessToken = $session->get('credential_access_token');
} else {
$oauthClient = new Client();
try {
$response = $oauthClient->post($config['expose_base_uri'] . '/oauth/v2/token', [
'json' => [
'client_id' => $config['client_id'],
'client_secret' => $config['client_secret'],
'client_id' => $config['expose_client_id'],
'client_secret' => $config['expose_client_secret'],
'grant_type' => 'client_credentials',
'scope' => 'publish'
]
@@ -504,11 +556,13 @@ class PSExposeController extends Controller
$tokenBody = json_decode($tokenBody,true);
$config['token'] = $tokenBody['access_token'];
$session->set('credential_access_token', $tokenBody['access_token']);
$this->app['conf']->set(['phraseanet-service', 'expose-service', 'exposes', $exposeName], $config);
$accessToken = $tokenBody['access_token'];
}
}
return $config;
return $accessToken;
}
private function postPublication(Client $exposeClient, $token, $publicationData)
@@ -565,4 +619,12 @@ class PSExposeController extends Controller
{
return $this->app['dispatcher'];
}
/**
* @return Session
*/
private function getSession()
{
return $this->app['session'];
}
}

View File

@@ -7,6 +7,8 @@ use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
class PSExposeConnectionType extends AbstractType
{
@@ -27,7 +29,7 @@ class PSExposeConnectionType extends AbstractType
],
'choices' => [
'client_credentials' => 'client_credentials',
'authorization_code' => 'authorization_code'
'password' => 'password'
]
])
->add('expose_name', TextType::class, [
@@ -43,19 +45,42 @@ class PSExposeConnectionType extends AbstractType
]
])
->add('expose_base_uri', TextType::class, [
'label' => 'admin:phrasea-service-setting:tab:expose:: Base Uri Expose api',
'label' => 'admin:phrasea-service-setting:tab:expose:: Expose Base Uri api',
'attr' => [
'class' => 'input-xxlarge'
]
])
->add('client_secret', TextType::class, [
'label' => 'admin:phrasea-service-setting:tab:expose:: Client secret',
->add('expose_client_secret', TextType::class, [
'label' => 'admin:phrasea-service-setting:tab:expose:: Expose Client secret',
'required' => false,
'attr' => [
'class' => 'input-xxlarge'
]
])
->add('client_id', TextType::class, [
'label' => 'admin:phrasea-service-setting:tab:expose:: Client ID',
->add('expose_client_id', TextType::class, [
'label' => 'admin:phrasea-service-setting:tab:expose:: Expose Client ID',
'required' => false,
'attr' => [
'class' => 'input-xxlarge'
]
])
->add('auth_base_uri', TextType::class, [
'label' => 'admin:phrasea-service-setting:tab:expose:: Auth Base Uri ',
'required' => false,
'attr' => [
'class' => 'input-xxlarge'
]
])
->add('auth_client_secret', TextType::class, [
'label' => 'admin:phrasea-service-setting:tab:expose:: Auth Client secret',
'required' => false,
'attr' => [
'class' => 'input-xxlarge'
]
])
->add('auth_client_id', TextType::class, [
'label' => 'admin:phrasea-service-setting:tab:expose:: Auth Client ID',
'required' => false,
'attr' => [
'class' => 'input-xxlarge'
]

View File

@@ -30,6 +30,10 @@ class PSExposeServiceProvider implements ControllerProviderInterface, ServicePro
{
$controllers = $this->createAuthenticatedCollection($app);
$controllers->match('/authenticate/', 'controller.ps.expose:authenticateAction')
->method('POST')
->bind('ps_expose_authenticate');
$controllers->match('/create-publication/', 'controller.ps.expose:createPublicationAction')
->method('POST')
->bind('ps_expose_create_publication');

View File

@@ -9,12 +9,14 @@ class ExposeUploadEvent extends SfEvent
private $lst;
private $exposeName;
private $publicationId;
private $accessToken;
public function __construct($lst, $exposeName, $publicationId)
public function __construct($lst, $exposeName, $publicationId, $accessToken)
{
$this->lst = $lst;
$this->exposeName = $exposeName;
$this->publicationId = $publicationId;
$this->accessToken = $accessToken;
}
public function getLst()
@@ -31,4 +33,9 @@ class ExposeUploadEvent extends SfEvent
{
return $this->publicationId;
}
public function getAccessToken()
{
return $this->accessToken;
}
}

View File

@@ -31,7 +31,8 @@ class ExposeSubscriber implements EventSubscriberInterface
'recordId' => (int) $basrec[1],
'databoxId' => (int) $basrec[0],
'exposeName' => $event->getExposeName(),
'publicationId' => $event->getPublicationId()
'publicationId' => $event->getPublicationId(),
'accessToken' => $event->getAccessToken()
]
];

View File

@@ -58,8 +58,6 @@ class ExposeUploadWorker implements WorkerInterface
$em->rollback();
}
// TODO: taken account admin config ,access_token for user or client_credentiels
$exposeConfiguration = $this->app['conf']->get(['phraseanet-service', 'expose-service', 'exposes'], []);
$exposeConfiguration = $exposeConfiguration[$payload['exposeName']];
@@ -140,7 +138,7 @@ class ExposeUploadWorker implements WorkerInterface
$response = $exposeClient->post('/assets', [
'headers' => [
'Authorization' => 'Bearer ' . $exposeConfiguration['token']
'Authorization' => 'Bearer ' . $payload['accessToken']
],
'multipart' => $multipartData
]);
@@ -155,7 +153,7 @@ class ExposeUploadWorker implements WorkerInterface
$this->postSubDefinition(
$exposeClient,
$exposeConfiguration['token'],
$payload['accessToken'],
$record->get_subdef('preview')->getRealPath(),
$assetsResponse['id'],
'preview',
@@ -166,7 +164,7 @@ class ExposeUploadWorker implements WorkerInterface
$this->postSubDefinition(
$exposeClient,
$exposeConfiguration['token'],
$payload['accessToken'],
$record->get_subdef('thumbnail')->getRealPath(),
$assetsResponse['id'],
'thumbnail',

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
<file date="2020-10-20T09:13:59Z" source-language="en" target-language="de" datatype="plaintext" original="not.available">
<file date="2020-11-03T11:33:20Z" source-language="en" target-language="de" datatype="plaintext" original="not.available">
<header>
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
<file date="2020-10-20T09:14:45Z" source-language="en" target-language="en" datatype="plaintext" original="not.available">
<file date="2020-11-03T11:34:06Z" source-language="en" target-language="en" datatype="plaintext" original="not.available">
<header>
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
<file date="2020-10-20T09:15:34Z" source-language="en" target-language="fr" datatype="plaintext" original="not.available">
<file date="2020-11-03T11:34:58Z" source-language="en" target-language="fr" datatype="plaintext" original="not.available">
<header>
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
<file date="2020-10-20T09:16:23Z" source-language="en" target-language="nl" datatype="plaintext" original="not.available">
<file date="2020-11-03T11:35:51Z" source-language="en" target-language="nl" datatype="plaintext" original="not.available">
<header>
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>

View File

@@ -30,12 +30,24 @@
{{ form_row(form.expose_base_uri) }}
</div>
<div class="control-group">
{{ form_row(form.client_secret) }}
<div class="control-group expose-field">
{{ form_row(form.expose_client_secret) }}
</div>
<div class="control-group">
{{ form_row(form.client_id) }}
<div class="control-group expose-field">
{{ form_row(form.expose_client_id) }}
</div>
<div class="control-group auth-field">
{{ form_row(form.auth_base_uri) }}
</div>
<div class="control-group auth-field">
{{ form_row(form.auth_client_secret) }}
</div>
<div class="control-group auth-field">
{{ form_row(form.auth_client_id) }}
</div>
<div class="control-group auth-connection-field">
@@ -123,6 +135,8 @@
$( function() {
$( ".expose-block" ).each(function( index ) {
$(this).prev('.expose-title').html( $(this).find('.expose-name').val() );
displayField($(this).find('.auth-connection'));
});
$("#expose-list" ).accordion(
{ event: "click",
@@ -130,10 +144,28 @@
collapsible: true
}
);
$('#expose-list').on('change', '.auth-connection', function(){
displayField($(this));
});
} );
function displayField(connectionKind) {
let authFields = connectionKind.parents('.expose-config-block').siblings('.auth-field');
let exposeFields = connectionKind.parents('.expose-config-block').siblings('.expose-field');
switch (connectionKind.val()) {
case 'password':
exposeFields.addClass('hidden');
authFields.removeClass('hidden');
break;
case 'client_credentials':
authFields.addClass('hidden');
exposeFields.removeClass('hidden');
break;
}
}
});
</script>

View File

@@ -296,38 +296,6 @@
});
});
//generate publication list
$('#expose_list').on('change', function () {
$.ajax({
type: "GET",
url: `/prod/expose/list-publication/?format=json&exposeName=` + this.value,
success: function (data) {
$('#DIALOG-expose-add #publication_parent').empty().html('<option value="">Select a parent publication</option>');
for (i = 0; i < data.publications.length; i++) {
$('#DIALOG-expose-add select#publication_parent').append('<option value='+data.publications[i].id+' >'+data.publications[i].title+'</option>');
}
}
});
$.ajax({
type: "GET",
url: `/prod/expose/list-profile?exposeName=` + this.value,
success: function (data) {
$('#DIALOG-expose-add select#profile-field').empty().html('<option value="">Select Profile</option>');;
for (i = 0; i < data.profiles.length; i++) {
$('select#profile-field').append('<option ' +
'value=' + data.basePath + '/' + data.profiles[i].id + ' >'
+ data.profiles[i].name +
'</option>'
);
}
}
});
});
</script>
<style>
.visibility-hidden {

View File

@@ -497,10 +497,8 @@
<div class="insidebloc expose_insidebloc">
<div id="validations-block" class="validations-block publication-list">
</div>
</div>
</div>
{# <div id="DIALOG-expose"></div>#}
<div id='DIALOG-expose-edit' style="display: none"></div>
{% import 'prod/WorkZone/ExposeNew.html.twig' as ExposeNew %}