mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
PHRAS-3253 user authentication via auth service
This commit is contained in:
28
Phraseanet-production-client/dist/production.js
vendored
28
Phraseanet-production-client/dist/production.js
vendored
@@ -9465,7 +9465,7 @@ var workzone = function workzone(services) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
(0, _jquery2.default)('.add_publication').on('click', function (event) {
|
(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) {
|
(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({
|
(0, _jquery2.default)('#DIALOG-expose-add').attr('title', localeService.t('Edit expose title')).dialog({
|
||||||
autoOpen: false,
|
autoOpen: false,
|
||||||
closeOnEscape: true,
|
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').on('click', '.close-expose-modal', function () {
|
||||||
(0, _jquery2.default)('#DIALOG-expose-add').dialog('close');
|
(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) {
|
function openExposePublicationEdit(edit) {
|
||||||
|
@@ -9465,7 +9465,7 @@ var workzone = function workzone(services) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
(0, _jquery2.default)('.add_publication').on('click', function (event) {
|
(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) {
|
(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({
|
(0, _jquery2.default)('#DIALOG-expose-add').attr('title', localeService.t('Edit expose title')).dialog({
|
||||||
autoOpen: false,
|
autoOpen: false,
|
||||||
closeOnEscape: true,
|
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').on('click', '.close-expose-modal', function () {
|
||||||
(0, _jquery2.default)('#DIALOG-expose-add').dialog('close');
|
(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) {
|
function openExposePublicationEdit(edit) {
|
||||||
|
@@ -91,7 +91,7 @@ const workzone = (services) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('.add_publication').on('click',function (event) {
|
$('.add_publication').on('click',function (event) {
|
||||||
openExposePublicationAdd();
|
openExposePublicationAdd($('#expose_list').val());
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.refresh-list').on('click',function (event) {
|
$('.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-expose-add').attr('title', localeService.t('Edit expose title'))
|
||||||
.dialog({
|
.dialog({
|
||||||
autoOpen: false,
|
autoOpen: false,
|
||||||
@@ -926,6 +926,34 @@ const workzone = (services) => {
|
|||||||
$('#DIALOG-expose-add').on('click', '.close-expose-modal', function () {
|
$('#DIALOG-expose-add').on('click', '.close-expose-modal', function () {
|
||||||
$('#DIALOG-expose-add').dialog('close');
|
$('#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) {
|
function openExposePublicationEdit(edit) {
|
||||||
|
@@ -4,15 +4,70 @@ namespace Alchemy\Phrasea\PhraseanetService\Controller;
|
|||||||
|
|
||||||
use Alchemy\Phrasea\Application as PhraseaApplication;
|
use Alchemy\Phrasea\Application as PhraseaApplication;
|
||||||
use Alchemy\Phrasea\Controller\Controller;
|
use Alchemy\Phrasea\Controller\Controller;
|
||||||
use Alchemy\Phrasea\Controller\RecordsRequest;
|
|
||||||
use Alchemy\Phrasea\WorkerManager\Event\ExposeUploadEvent;
|
use Alchemy\Phrasea\WorkerManager\Event\ExposeUploadEvent;
|
||||||
use Alchemy\Phrasea\WorkerManager\Event\WorkerEvents;
|
use Alchemy\Phrasea\WorkerManager\Event\WorkerEvents;
|
||||||
use GuzzleHttp\Client;
|
use GuzzleHttp\Client;
|
||||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
use Symfony\Component\HttpFoundation\Session\Session;
|
||||||
|
|
||||||
class PSExposeController extends Controller
|
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
|
* Get list of publication
|
||||||
* Use param "format=json" to retrieve a json
|
* Use param "format=json" to retrieve a json
|
||||||
@@ -23,7 +78,7 @@ class PSExposeController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function listPublicationAction(PhraseaApplication $app, Request $request)
|
public function listPublicationAction(PhraseaApplication $app, Request $request)
|
||||||
{
|
{
|
||||||
if ( $request->get('exposeName') == null) {
|
if ($request->get('exposeName') == null) {
|
||||||
return $this->render("prod/WorkZone/ExposeList.html.twig", [
|
return $this->render("prod/WorkZone/ExposeList.html.twig", [
|
||||||
'publications' => [],
|
'publications' => [],
|
||||||
]);
|
]);
|
||||||
@@ -32,21 +87,27 @@ class PSExposeController extends Controller
|
|||||||
$exposeConfiguration = $app['conf']->get(['phraseanet-service', 'expose-service', 'exposes'], []);
|
$exposeConfiguration = $app['conf']->get(['phraseanet-service', 'expose-service', 'exposes'], []);
|
||||||
$exposeConfiguration = $exposeConfiguration[$request->get('exposeName')];
|
$exposeConfiguration = $exposeConfiguration[$request->get('exposeName')];
|
||||||
|
|
||||||
$exposeClient = new Client(['base_uri' => $exposeConfiguration['expose_base_uri'], 'http_errors' => false]);
|
$session = $this->getSession();
|
||||||
|
|
||||||
if (!isset($exposeConfiguration['token'])) {
|
if (!$session->has('password_access_token') && $exposeConfiguration['connection_kind'] == 'password' && $request->get('format') != 'json') {
|
||||||
$exposeConfiguration = $this->generateAndSaveToken($exposeConfiguration, $request->get('exposeName'));
|
return $this->render("prod/WorkZone/ExposeOauthLogin.html.twig", [
|
||||||
|
'exposeName' => $request->get('exposeName')
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$accessToken = $this->getAndSaveToken($exposeConfiguration);
|
||||||
|
|
||||||
if ($exposeConfiguration == null ) {
|
if ($exposeConfiguration == null ) {
|
||||||
return $this->render("prod/WorkZone/ExposeList.html.twig", [
|
return $this->render("prod/WorkZone/ExposeList.html.twig", [
|
||||||
'publications' => [],
|
'publications' => [],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$exposeClient = new Client(['base_uri' => $exposeConfiguration['expose_base_uri'], 'http_errors' => false]);
|
||||||
|
|
||||||
$response = $exposeClient->get('/publications?flatten=true&order[createdAt]=desc', [
|
$response = $exposeClient->get('/publications?flatten=true&order[createdAt]=desc', [
|
||||||
'headers' => [
|
'headers' => [
|
||||||
'Authorization' => 'Bearer '. $exposeConfiguration['token'],
|
'Authorization' => 'Bearer '. $accessToken,
|
||||||
'Content-Type' => 'application/json'
|
'Content-Type' => 'application/json'
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
@@ -86,14 +147,12 @@ class PSExposeController extends Controller
|
|||||||
|
|
||||||
$exposeClient = new Client(['base_uri' => $exposeConfiguration['expose_base_uri'], 'http_errors' => false]);
|
$exposeClient = new Client(['base_uri' => $exposeConfiguration['expose_base_uri'], 'http_errors' => false]);
|
||||||
|
|
||||||
if (!isset($exposeConfiguration['token'])) {
|
$accessToken = $this->getAndSaveToken($exposeConfiguration);
|
||||||
$exposeConfiguration = $this->generateAndSaveToken($exposeConfiguration, $request->get('exposeName'));
|
|
||||||
}
|
|
||||||
|
|
||||||
$publication = [];
|
$publication = [];
|
||||||
$resPublication = $exposeClient->get('/publications/' . $request->get('publicationId') , [
|
$resPublication = $exposeClient->get('/publications/' . $request->get('publicationId') , [
|
||||||
'headers' => [
|
'headers' => [
|
||||||
'Authorization' => 'Bearer '. $exposeConfiguration['token'],
|
'Authorization' => 'Bearer '. $accessToken,
|
||||||
'Content-Type' => 'application/json'
|
'Content-Type' => 'application/json'
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
@@ -139,13 +198,11 @@ class PSExposeController extends Controller
|
|||||||
|
|
||||||
$exposeClient = new Client(['base_uri' => $exposeConfiguration['expose_base_uri'], 'http_errors' => false]);
|
$exposeClient = new Client(['base_uri' => $exposeConfiguration['expose_base_uri'], 'http_errors' => false]);
|
||||||
|
|
||||||
if (!isset($exposeConfiguration['token'])) {
|
$accessToken = $this->getAndSaveToken($exposeConfiguration);
|
||||||
$exposeConfiguration = $this->generateAndSaveToken($exposeConfiguration, $request->get('exposeName'));
|
|
||||||
}
|
|
||||||
|
|
||||||
$resPublication = $exposeClient->get('/publications/' . $request->get('publicationId') . '/assets?page=' . $page , [
|
$resPublication = $exposeClient->get('/publications/' . $request->get('publicationId') . '/assets?page=' . $page , [
|
||||||
'headers' => [
|
'headers' => [
|
||||||
'Authorization' => 'Bearer '. $exposeConfiguration['token'],
|
'Authorization' => 'Bearer '. $accessToken,
|
||||||
'Content-Type' => 'application/json'
|
'Content-Type' => 'application/json'
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
@@ -194,16 +251,14 @@ class PSExposeController extends Controller
|
|||||||
|
|
||||||
$exposeClient = new Client(['base_uri' => $exposeConfiguration['expose_base_uri'], 'http_errors' => false]);
|
$exposeClient = new Client(['base_uri' => $exposeConfiguration['expose_base_uri'], 'http_errors' => false]);
|
||||||
|
|
||||||
if (!isset($exposeConfiguration['token'])) {
|
$accessToken = $this->getAndSaveToken($exposeConfiguration);
|
||||||
$exposeConfiguration = $this->generateAndSaveToken($exposeConfiguration, $request->get('exposeName'));
|
|
||||||
}
|
|
||||||
|
|
||||||
$profiles = [];
|
$profiles = [];
|
||||||
$basePath = '';
|
$basePath = '';
|
||||||
|
|
||||||
$resProfile = $exposeClient->get('/publication-profiles' , [
|
$resProfile = $exposeClient->get('/publication-profiles' , [
|
||||||
'headers' => [
|
'headers' => [
|
||||||
'Authorization' => 'Bearer '. $exposeConfiguration['token'],
|
'Authorization' => 'Bearer '. $accessToken,
|
||||||
'Content-Type' => 'application/json'
|
'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 = $app['conf']->get(['phraseanet-service', 'expose-service', 'exposes'], []);
|
||||||
$exposeConfiguration = $exposeConfiguration[$exposeName];
|
$exposeConfiguration = $exposeConfiguration[$exposeName];
|
||||||
|
|
||||||
$exposeClient = new Client(['base_uri' => $exposeConfiguration['expose_base_uri'], 'http_errors' => false]);
|
$exposeClient = new Client(['base_uri' => $exposeConfiguration['expose_base_uri'], 'http_errors' => false]);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!isset($exposeConfiguration['token'])) {
|
$accessToken = $this->getAndSaveToken($exposeConfiguration);
|
||||||
$exposeConfiguration = $this->generateAndSaveToken($exposeConfiguration, $exposeName);
|
|
||||||
}
|
|
||||||
|
|
||||||
$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) {
|
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) {
|
if ($response->getStatusCode() !== 201) {
|
||||||
@@ -304,23 +355,19 @@ class PSExposeController extends Controller
|
|||||||
{
|
{
|
||||||
$exposeName = $request->get('exposeName');
|
$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 = $app['conf']->get(['phraseanet-service', 'expose-service', 'exposes'], []);
|
||||||
$exposeConfiguration = $exposeConfiguration[$exposeName];
|
$exposeConfiguration = $exposeConfiguration[$exposeName];
|
||||||
|
|
||||||
$exposeClient = new Client(['base_uri' => $exposeConfiguration['expose_base_uri'], 'http_errors' => false]);
|
$exposeClient = new Client(['base_uri' => $exposeConfiguration['expose_base_uri'], 'http_errors' => false]);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!isset($exposeConfiguration['token'])) {
|
$accessToken = $this->getAndSaveToken($exposeConfiguration);
|
||||||
$exposeConfiguration = $this->generateAndSaveToken($exposeConfiguration, $exposeName);
|
|
||||||
}
|
|
||||||
|
|
||||||
$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) {
|
if ($response->getStatusCode() == 401) {
|
||||||
$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() !== 200) {
|
if ($response->getStatusCode() !== 200) {
|
||||||
@@ -354,23 +401,19 @@ class PSExposeController extends Controller
|
|||||||
{
|
{
|
||||||
$exposeName = $request->get('exposeName');
|
$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 = $app['conf']->get(['phraseanet-service', 'expose-service', 'exposes'], []);
|
||||||
$exposeConfiguration = $exposeConfiguration[$exposeName];
|
$exposeConfiguration = $exposeConfiguration[$exposeName];
|
||||||
|
|
||||||
$exposeClient = new Client(['base_uri' => $exposeConfiguration['expose_base_uri'], 'http_errors' => false]);
|
$exposeClient = new Client(['base_uri' => $exposeConfiguration['expose_base_uri'], 'http_errors' => false]);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!isset($exposeConfiguration['token'])) {
|
$accessToken = $this->getAndSaveToken($exposeConfiguration);
|
||||||
$exposeConfiguration = $this->generateAndSaveToken($exposeConfiguration, $exposeName);
|
|
||||||
}
|
|
||||||
|
|
||||||
$response = $this->removePublication($exposeClient, $request->get('publicationId'), $exposeConfiguration['token']);
|
$response = $this->removePublication($exposeClient, $request->get('publicationId'), $accessToken);
|
||||||
|
|
||||||
if ($response->getStatusCode() == 401) {
|
if ($response->getStatusCode() == 401) {
|
||||||
$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() !== 204) {
|
if ($response->getStatusCode() !== 204) {
|
||||||
@@ -404,23 +447,19 @@ class PSExposeController extends Controller
|
|||||||
{
|
{
|
||||||
$exposeName = $request->get('exposeName');
|
$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 = $app['conf']->get(['phraseanet-service', 'expose-service', 'exposes'], []);
|
||||||
$exposeConfiguration = $exposeConfiguration[$exposeName];
|
$exposeConfiguration = $exposeConfiguration[$exposeName];
|
||||||
|
|
||||||
$exposeClient = new Client(['base_uri' => $exposeConfiguration['expose_base_uri'], 'http_errors' => false]);
|
$exposeClient = new Client(['base_uri' => $exposeConfiguration['expose_base_uri'], 'http_errors' => false]);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!isset($exposeConfiguration['token'])) {
|
$accessToken = $this->getAndSaveToken($exposeConfiguration);
|
||||||
$exposeConfiguration = $this->generateAndSaveToken($exposeConfiguration, $exposeName);
|
|
||||||
}
|
|
||||||
|
|
||||||
$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) {
|
if ($response->getStatusCode() == 401) {
|
||||||
$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() !== 204) {
|
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([
|
return $app->json([
|
||||||
'success' => true,
|
'success' => true,
|
||||||
@@ -474,41 +517,52 @@ class PSExposeController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get Token and save in session
|
||||||
* @param $config
|
* @param $config
|
||||||
* @param $exposeName
|
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
private function generateAndSaveToken($config, $exposeName)
|
private function getAndSaveToken($config)
|
||||||
{
|
{
|
||||||
$oauthClient = new Client();
|
$session = $this->getSession();
|
||||||
|
|
||||||
try {
|
$accessToken = '';
|
||||||
$response = $oauthClient->post($config['expose_base_uri'] . '/oauth/v2/token', [
|
if ($config['connection_kind'] == 'password') {
|
||||||
'json' => [
|
$accessToken = $session->get('password_access_token');
|
||||||
'client_id' => $config['client_id'],
|
} elseif ($config['connection_kind'] == 'client_credentials') {
|
||||||
'client_secret' => $config['client_secret'],
|
if ($session->has('credential_access_token')) {
|
||||||
'grant_type' => 'client_credentials',
|
$accessToken = $session->get('credential_access_token');
|
||||||
'scope' => 'publish'
|
} else {
|
||||||
]
|
$oauthClient = new Client();
|
||||||
]);
|
|
||||||
} catch(\Exception $e) {
|
try {
|
||||||
return null;
|
$response = $oauthClient->post($config['expose_base_uri'] . '/oauth/v2/token', [
|
||||||
|
'json' => [
|
||||||
|
'client_id' => $config['expose_client_id'],
|
||||||
|
'client_secret' => $config['expose_client_secret'],
|
||||||
|
'grant_type' => 'client_credentials',
|
||||||
|
'scope' => 'publish'
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
} catch(\Exception $e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($response->getStatusCode() !== 200) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$tokenBody = $response->getBody()->getContents();
|
||||||
|
|
||||||
|
$tokenBody = json_decode($tokenBody,true);
|
||||||
|
|
||||||
|
$session->set('credential_access_token', $tokenBody['access_token']);
|
||||||
|
|
||||||
|
$accessToken = $tokenBody['access_token'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($response->getStatusCode() !== 200) {
|
return $accessToken;
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$tokenBody = $response->getBody()->getContents();
|
|
||||||
|
|
||||||
$tokenBody = json_decode($tokenBody,true);
|
|
||||||
|
|
||||||
$config['token'] = $tokenBody['access_token'];
|
|
||||||
|
|
||||||
$this->app['conf']->set(['phraseanet-service', 'expose-service', 'exposes', $exposeName], $config);
|
|
||||||
|
|
||||||
return $config;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function postPublication(Client $exposeClient, $token, $publicationData)
|
private function postPublication(Client $exposeClient, $token, $publicationData)
|
||||||
@@ -565,4 +619,12 @@ class PSExposeController extends Controller
|
|||||||
{
|
{
|
||||||
return $this->app['dispatcher'];
|
return $this->app['dispatcher'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Session
|
||||||
|
*/
|
||||||
|
private function getSession()
|
||||||
|
{
|
||||||
|
return $this->app['session'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -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\ChoiceType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use Symfony\Component\Form\FormEvent;
|
||||||
|
use Symfony\Component\Form\FormEvents;
|
||||||
|
|
||||||
class PSExposeConnectionType extends AbstractType
|
class PSExposeConnectionType extends AbstractType
|
||||||
{
|
{
|
||||||
@@ -27,7 +29,7 @@ class PSExposeConnectionType extends AbstractType
|
|||||||
],
|
],
|
||||||
'choices' => [
|
'choices' => [
|
||||||
'client_credentials' => 'client_credentials',
|
'client_credentials' => 'client_credentials',
|
||||||
'authorization_code' => 'authorization_code'
|
'password' => 'password'
|
||||||
]
|
]
|
||||||
])
|
])
|
||||||
->add('expose_name', TextType::class, [
|
->add('expose_name', TextType::class, [
|
||||||
@@ -43,20 +45,43 @@ class PSExposeConnectionType extends AbstractType
|
|||||||
]
|
]
|
||||||
])
|
])
|
||||||
->add('expose_base_uri', TextType::class, [
|
->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' => [
|
'attr' => [
|
||||||
'class' => 'input-xxlarge'
|
'class' => 'input-xxlarge'
|
||||||
]
|
]
|
||||||
])
|
])
|
||||||
->add('client_secret', TextType::class, [
|
->add('expose_client_secret', TextType::class, [
|
||||||
'label' => 'admin:phrasea-service-setting:tab:expose:: Client secret',
|
'label' => 'admin:phrasea-service-setting:tab:expose:: Expose Client secret',
|
||||||
'attr' => [
|
'required' => false,
|
||||||
|
'attr' => [
|
||||||
'class' => 'input-xxlarge'
|
'class' => 'input-xxlarge'
|
||||||
]
|
]
|
||||||
])
|
])
|
||||||
->add('client_id', TextType::class, [
|
->add('expose_client_id', TextType::class, [
|
||||||
'label' => 'admin:phrasea-service-setting:tab:expose:: Client ID',
|
'label' => 'admin:phrasea-service-setting:tab:expose:: Expose Client ID',
|
||||||
'attr' => [
|
'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'
|
'class' => 'input-xxlarge'
|
||||||
]
|
]
|
||||||
])
|
])
|
||||||
|
@@ -30,6 +30,10 @@ class PSExposeServiceProvider implements ControllerProviderInterface, ServicePro
|
|||||||
{
|
{
|
||||||
$controllers = $this->createAuthenticatedCollection($app);
|
$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')
|
$controllers->match('/create-publication/', 'controller.ps.expose:createPublicationAction')
|
||||||
->method('POST')
|
->method('POST')
|
||||||
->bind('ps_expose_create_publication');
|
->bind('ps_expose_create_publication');
|
||||||
|
@@ -9,12 +9,14 @@ class ExposeUploadEvent extends SfEvent
|
|||||||
private $lst;
|
private $lst;
|
||||||
private $exposeName;
|
private $exposeName;
|
||||||
private $publicationId;
|
private $publicationId;
|
||||||
|
private $accessToken;
|
||||||
|
|
||||||
public function __construct($lst, $exposeName, $publicationId)
|
public function __construct($lst, $exposeName, $publicationId, $accessToken)
|
||||||
{
|
{
|
||||||
$this->lst = $lst;
|
$this->lst = $lst;
|
||||||
$this->exposeName = $exposeName;
|
$this->exposeName = $exposeName;
|
||||||
$this->publicationId = $publicationId;
|
$this->publicationId = $publicationId;
|
||||||
|
$this->accessToken = $accessToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLst()
|
public function getLst()
|
||||||
@@ -31,4 +33,9 @@ class ExposeUploadEvent extends SfEvent
|
|||||||
{
|
{
|
||||||
return $this->publicationId;
|
return $this->publicationId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getAccessToken()
|
||||||
|
{
|
||||||
|
return $this->accessToken;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -31,7 +31,8 @@ class ExposeSubscriber implements EventSubscriberInterface
|
|||||||
'recordId' => (int) $basrec[1],
|
'recordId' => (int) $basrec[1],
|
||||||
'databoxId' => (int) $basrec[0],
|
'databoxId' => (int) $basrec[0],
|
||||||
'exposeName' => $event->getExposeName(),
|
'exposeName' => $event->getExposeName(),
|
||||||
'publicationId' => $event->getPublicationId()
|
'publicationId' => $event->getPublicationId(),
|
||||||
|
'accessToken' => $event->getAccessToken()
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@@ -58,8 +58,6 @@ class ExposeUploadWorker implements WorkerInterface
|
|||||||
$em->rollback();
|
$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 = $this->app['conf']->get(['phraseanet-service', 'expose-service', 'exposes'], []);
|
||||||
$exposeConfiguration = $exposeConfiguration[$payload['exposeName']];
|
$exposeConfiguration = $exposeConfiguration[$payload['exposeName']];
|
||||||
|
|
||||||
@@ -140,7 +138,7 @@ class ExposeUploadWorker implements WorkerInterface
|
|||||||
|
|
||||||
$response = $exposeClient->post('/assets', [
|
$response = $exposeClient->post('/assets', [
|
||||||
'headers' => [
|
'headers' => [
|
||||||
'Authorization' => 'Bearer ' . $exposeConfiguration['token']
|
'Authorization' => 'Bearer ' . $payload['accessToken']
|
||||||
],
|
],
|
||||||
'multipart' => $multipartData
|
'multipart' => $multipartData
|
||||||
]);
|
]);
|
||||||
@@ -155,7 +153,7 @@ class ExposeUploadWorker implements WorkerInterface
|
|||||||
|
|
||||||
$this->postSubDefinition(
|
$this->postSubDefinition(
|
||||||
$exposeClient,
|
$exposeClient,
|
||||||
$exposeConfiguration['token'],
|
$payload['accessToken'],
|
||||||
$record->get_subdef('preview')->getRealPath(),
|
$record->get_subdef('preview')->getRealPath(),
|
||||||
$assetsResponse['id'],
|
$assetsResponse['id'],
|
||||||
'preview',
|
'preview',
|
||||||
@@ -166,7 +164,7 @@ class ExposeUploadWorker implements WorkerInterface
|
|||||||
|
|
||||||
$this->postSubDefinition(
|
$this->postSubDefinition(
|
||||||
$exposeClient,
|
$exposeClient,
|
||||||
$exposeConfiguration['token'],
|
$payload['accessToken'],
|
||||||
$record->get_subdef('thumbnail')->getRealPath(),
|
$record->get_subdef('thumbnail')->getRealPath(),
|
||||||
$assetsResponse['id'],
|
$assetsResponse['id'],
|
||||||
'thumbnail',
|
'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
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?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">
|
<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>
|
<header>
|
||||||
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
|
<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>
|
<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>
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?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">
|
<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>
|
<header>
|
||||||
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
|
<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>
|
<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>
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?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">
|
<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>
|
<header>
|
||||||
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
|
<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>
|
<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>
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?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">
|
<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>
|
<header>
|
||||||
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
|
<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>
|
<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>
|
||||||
|
@@ -30,12 +30,24 @@
|
|||||||
{{ form_row(form.expose_base_uri) }}
|
{{ form_row(form.expose_base_uri) }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="control-group">
|
<div class="control-group expose-field">
|
||||||
{{ form_row(form.client_secret) }}
|
{{ form_row(form.expose_client_secret) }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="control-group">
|
<div class="control-group expose-field">
|
||||||
{{ form_row(form.client_id) }}
|
{{ 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>
|
||||||
|
|
||||||
<div class="control-group auth-connection-field">
|
<div class="control-group auth-connection-field">
|
||||||
@@ -123,6 +135,8 @@
|
|||||||
$( function() {
|
$( function() {
|
||||||
$( ".expose-block" ).each(function( index ) {
|
$( ".expose-block" ).each(function( index ) {
|
||||||
$(this).prev('.expose-title').html( $(this).find('.expose-name').val() );
|
$(this).prev('.expose-title').html( $(this).find('.expose-name').val() );
|
||||||
|
|
||||||
|
displayField($(this).find('.auth-connection'));
|
||||||
});
|
});
|
||||||
$("#expose-list" ).accordion(
|
$("#expose-list" ).accordion(
|
||||||
{ event: "click",
|
{ event: "click",
|
||||||
@@ -130,10 +144,28 @@
|
|||||||
collapsible: true
|
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>
|
</script>
|
||||||
|
@@ -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>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
.visibility-hidden {
|
.visibility-hidden {
|
||||||
|
@@ -497,10 +497,8 @@
|
|||||||
<div class="insidebloc expose_insidebloc">
|
<div class="insidebloc expose_insidebloc">
|
||||||
<div id="validations-block" class="validations-block publication-list">
|
<div id="validations-block" class="validations-block publication-list">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{# <div id="DIALOG-expose"></div>#}
|
|
||||||
<div id='DIALOG-expose-edit' style="display: none"></div>
|
<div id='DIALOG-expose-edit' style="display: none"></div>
|
||||||
|
|
||||||
{% import 'prod/WorkZone/ExposeNew.html.twig' as ExposeNew %}
|
{% import 'prod/WorkZone/ExposeNew.html.twig' as ExposeNew %}
|
||||||
|
Reference in New Issue
Block a user