Skip to content

Commit

Permalink
Merge pull request #390 from xibosignage/release18
Browse files Browse the repository at this point in the history
1.8.10 hotfix
  • Loading branch information
dasgarner authored Jul 5, 2018
2 parents 1eaf396 + 5892fd3 commit b3f84ed
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 37 deletions.
1 change: 1 addition & 0 deletions lib/Controller/Schedule.php
Original file line number Diff line number Diff line change
Expand Up @@ -890,6 +890,7 @@ function editForm($eventId)
'commands' => $this->commandFactory->query(),
'dayParts' => $this->dayPartFactory->allWithSystem(),
'displayGroups' => $schedule->displayGroups,
'campaign' => ($schedule->campaignId != '') ? $this->campaignFactory->getById($schedule->campaignId) : null,
'displayGroupIds' => array_map(function($element) {
return $element->displayGroupId;
}, $schedule->displayGroups),
Expand Down
22 changes: 13 additions & 9 deletions lib/Middleware/SAMLAuthentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
namespace Xibo\Middleware;


use OneLogin\Saml2\Auth;
use OneLogin\Saml2\Error;
use OneLogin\Saml2\Settings;
use OneLogin\Saml2\Utils;
use Slim\Middleware;
use Xibo\Entity\User;
use Xibo\Exception\AccessDeniedException;
Expand Down Expand Up @@ -55,7 +59,7 @@ public function samlLogout()
isset($this->app->configService->samlSettings['workflow']['slo']) &&
$this->app->configService->samlSettings['workflow']['slo'] == true) {
// Initiate SAML SLO
$auth = new \OneLogin_Saml2_Auth($this->app->configService->samlSettings);
$auth = new Auth($this->app->configService->samlSettings);
$auth->logout();
} else {
$this->app->redirect($this->app->urlFor('logout'));
Expand All @@ -80,7 +84,7 @@ public function call()
$app->logoutRoute = 'saml.logout';

$app->get('/saml/metadata', function () {
$settings = new \OneLogin_Saml2_Settings($this->app->configService->samlSettings, true);
$settings = new Settings($this->app->configService->samlSettings, true);
$metadata = $settings->getSPMetadata();
$errors = $settings->validateMetadata($metadata);
if (empty($errors)) {
Expand All @@ -90,14 +94,14 @@ public function call()
} else {
throw new \Xibo\Exception\ConfigurationException(
'Invalid SP metadata: '.implode(', ', $errors),
\OneLogin_Saml2_Error::METADATA_SP_INVALID
Error::METADATA_SP_INVALID
);
}
});

$app->get('/saml/login', function () {
// Initiate SAML SSO
$auth = new \OneLogin_Saml2_Auth($this->app->configService->samlSettings);
$auth = new Auth($this->app->configService->samlSettings);
$auth->login();
});

Expand All @@ -110,21 +114,21 @@ public function call()
$app = $this->getApplication();

// Log some interesting things
$app->getLog()->debug('Arrived at the ACS route with own URL: ' . \OneLogin_Saml2_Utils::getSelfRoutedURLNoQuery());
$app->getLog()->debug('Arrived at the ACS route with own URL: ' . Utils::getSelfRoutedURLNoQuery());

// Inject the POST parameters required by the SAML toolkit
$_POST = $this->app->request->post();

// Pull out the SAML settings
$samlSettings = $this->app->configService->samlSettings;

$auth = new \OneLogin_Saml2_Auth($samlSettings);
$auth = new Auth($samlSettings);
$auth->processResponse();

$errors = $auth->getErrors();

if (!empty($errors)) {
throw new \OneLogin_Saml2_Error(
throw new Error(
'SAML SSO failed: '.implode(', ', $errors) . '. Last Reason: ' . $auth->getLastErrorReason()
);
} else {
Expand Down Expand Up @@ -315,7 +319,7 @@ public function call()
// Inject the GET parameters required by the SAML toolkit
$_GET = $this->app->request->get();

$auth = new \OneLogin_Saml2_Auth($this->app->configService->samlSettings);
$auth = new Auth($this->app->configService->samlSettings);
$auth->processSLO(false, null, false, function() use ($app) {
// Grab a login controller
/** @var \Xibo\Controller\Login $loginController */
Expand Down Expand Up @@ -347,7 +351,7 @@ public function call()
}
else {
// Initiate SAML SSO
$auth = new \OneLogin_Saml2_Auth($this->app->configService->samlSettings);
$auth = new Auth($this->app->configService->samlSettings);
$auth->login();
}
};
Expand Down
2 changes: 1 addition & 1 deletion views/schedule-form-add.twig
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@

{% set title %}{% trans "Layout / Campaign" %}{% endset %}
{% set helpText %}{% trans "Please select a Layout or Campaign for this Event to show" %}{% endset %}
{{ forms.dropdown("campaignId", "single", title, "", null, "id", "value", helpText, "layout-control", "", "", "", attributes, optionGroups) }}
{{ forms.dropdown("campaignId", "single", title, "", null, "id", "value", helpText, "layout-control", "", "", "", attributes) }}

<div class="form-group preview-button-container">
<div class="col-md-offset-2 col-md-10">
Expand Down
33 changes: 6 additions & 27 deletions views/schedule-form-edit.twig
Original file line number Diff line number Diff line change
Expand Up @@ -85,36 +85,15 @@
{{ forms.dateTime("toDt", title, event.toDt, helpText, "endtime-control", "required", "") }}

{# Campaign / Layout list. We want to build two arrays for us to use. #}
{% set layoutOptions = [] %}
{% set campaignOptions = [] %}

{% for item in campaigns %}
{% if item.isLayoutSpecific == 1 %}
{% set layoutOptions = layoutOptions|merge([{id: item.campaignId, value: item.campaign}]) %}
{% else %}
{% set campaignOptions = campaignOptions|merge([{id: item.campaignId, value: item.campaign}]) %}
{% endif %}
{% endfor %}

{# Add a blank campaign record #}
{% set campaignOptions = [{id: "", value: ""}]|merge(campaignOptions) %}

{# Add a blank layout record #}
{% set layoutOptions = [{id: "", value: ""}]|merge(layoutOptions) %}

{% set campaigns %}{% trans "Campaigns" %}{% endset %}
{% set layouts %}{% trans "Layouts" %}{% endset %}
{% set optionGroups = [
{id: "campaign", label: campaigns},
{id: "layout", label: layouts}
{% set attributes = [
{ name: "data-search-url", value: urlFor("campaign.search") },
{ name: "data-trans-campaigns", value: "Campaigns"|trans },
{ name: "data-trans-layouts", value: "Layouts"|trans }
] %}

{% set title %}{% trans "Layout / Campaign" %}{% endset %}
{% set helpText %}{% trans "Please select a Layout or Campaign for this Event to show" %}{% endset %}
{% set attributes = [
{ name: "data-live-search", value: "true" },
{ name: "data-selected-text-format", value: "count > 4" }
] %}
{{ forms.dropdown("campaignId", "single", title, event.campaignId, {campaign: campaignOptions, layout: layoutOptions}, "id", "value", helpText, "layout-control", "", "", "", attributes, optionGroups) }}
{{ forms.dropdown("campaignId", "single", title, event.campaignId, [campaign], "campaignId", "campaign", helpText, "layout-control", "", "", "", attributes) }}

<div class="form-group preview-button-container">
<div class="col-md-offset-2 col-md-10">
Expand Down

0 comments on commit b3f84ed

Please sign in to comment.