Skip to content

Commit

Permalink
Merge pull request #2523 from xibosignage/develop
Browse files Browse the repository at this point in the history
Release 4.0.11
  • Loading branch information
dasgarner authored May 14, 2024
2 parents 3f817b8 + 3e39097 commit 33d8176
Show file tree
Hide file tree
Showing 69 changed files with 1,450 additions and 1,013 deletions.
160 changes: 93 additions & 67 deletions docker/tmp/settings-custom.php
Original file line number Diff line number Diff line change
@@ -1,71 +1,97 @@
<?php
/*
* Copyright (C) 2024 Xibo Signage Ltd
*
* Xibo - Digital Signage - https://xibosignage.com
*
* This file is part of Xibo.
*
* Xibo is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* Xibo is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
*/

# If you need to add custom configuration settings to the CMS settings.php file,
# this is the place to do it.
// If you need to add custom configuration settings to the CMS settings.php file,
// this is the place to do it.

# For example, if you want to configure SAML authentication, you can add the
# required configuration here
// For example, if you want to configure SAML authentication, you can add the
// required configuration here

#$authentication = new \Xibo\Middleware\SAMLAuthentication();
#$samlSettings = array (
# 'workflow' => array(
# // Enable/Disable Just-In-Time provisioning
# 'jit' => true,
# // Attribute to identify the user
# 'field_to_identify' => 'UserName', // Alternatives: UserID, UserName or email
# // Default libraryQuota assigned to the created user by JIT
# 'libraryQuota' => 1000,
# // Initial User Group
# 'group' => 'Users',
# // Home Page
# 'homePage' => 'icondashboard.view',
# // Enable/Disable Single Logout
# 'slo' => true,
# // Attribute mapping between XIBO-CMS and the IdP
# 'mapping' => array (
# 'UserID' => '',
# 'usertypeid' => '',
# 'UserName' => 'uid',
# 'email' => 'mail',
# )
# ),
# // Settings for the PHP-SAML toolkit.
# // See documentation: https://github.com/onelogin/php-saml#settings
# 'strict' => false,
# 'debug' => true,
# 'idp' => array (
# 'entityId' => 'https://idp.example.com/simplesaml/saml2/idp/metadata.php',
# 'singleSignOnService' => array (
# 'url' => 'http://idp.example.com/simplesaml/saml2/idp/SSOService.php',
# ),
# 'singleLogoutService' => array (
# 'url' => 'http://idp.example.com/simplesaml/saml2/idp/SingleLogoutService.php',
# ),
# 'x509cert' => 'MIICbDCCAdWgAwIBAgIBADANBgkqhkiG9w0BAQ0FADBTMQswCQYDVQQGEwJ1czETMBEGA1UECAwKQ2FsaWZvcm5pYTEVMBMGA1UECgwMT25lbG9naW4gSW5jMRgwFgYDVQQDDA9pZHAuZXhhbXBsZS5jb20wHhcNMTQwOTIzMTIyNDA4WhcNNDIwMjA4MTIyNDA4WjBTMQswCQYDVQQGEwJ1czETMBEGA1UECAwKQ2FsaWZvcm5pYTEVMBMGA1UECgwMT25lbG9naW4gSW5jMRgwFgYDVQQDDA9pZHAuZXhhbXBsZS5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAOWA+YHU7cvPOrBOfxCscsYTJB+kH3MaA9BFrSHFS+KcR6cw7oPSktIJxUgvDpQbtfNcOkE/tuOPBDoech7AXfvH6d7Bw7xtW8PPJ2mB5Hn/HGW2roYhxmfh3tR5SdwN6i4ERVF8eLkvwCHsNQyK2Ref0DAJvpBNZMHCpS24916/AgMBAAGjUDBOMB0GA1UdDgQWBBQ77/qVeiigfhYDITplCNtJKZTM8DAfBgNVHSMEGDAWgBQ77/qVeiigfhYDITplCNtJKZTM8DAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBDQUAA4GBAJO2j/1uO80E5C2PM6Fk9mzerrbkxl7AZ/mvlbOn+sNZE+VZ1AntYuG8ekbJpJtG1YfRfc7EA9mEtqvv4dhv7zBy4nK49OR+KpIBjItWB5kYvrqMLKBa32sMbgqqUqeF1ENXKjpvLSuPdfGJZA3dNa/+Dyb8GGqWe707zLyc5F8m',
# ),
# 'sp' => array (
# 'entityId' => 'http://xibo-cms.example.com/saml/metadata',
# 'assertionConsumerService' => array (
# 'url' => 'http://xibo-cms.example.com/saml/acs',
# ),
# 'singleLogoutService' => array (
# 'url' => 'http://xibo-cms.example.com/saml/sls',
# ),
# 'NameIDFormat' => 'urn:oasis:names:tc:SAML:2.0:nameid-format:emailAddress',
# 'x509cert' => '',
# 'privateKey' > '',
# ),
# 'security' => array (
# 'nameIdEncrypted' => false,
# 'authnRequestsSigned' => false,
# 'logoutRequestSigned' => false,
# 'logoutResponseSigned' => false,
# 'signMetadata' => false,
# 'wantMessagesSigned' => false,
# 'wantAssertionsSigned' => false,
# 'wantAssertionsEncrypted' => false,
# 'wantNameIdEncrypted' => false,
# )
#);

?>
/*
$authentication = new \Xibo\Middleware\SAMLAuthentication();
$samlSettings = [
'workflow' => [
// Enable/Disable Just-In-Time provisioning
'jit' => true,
// Attribute to identify the user
'field_to_identify' => 'UserName', // Alternatives: UserID, UserName or email
// Default libraryQuota assigned to the created user by JIT
'libraryQuota' => 1000,
// Home Page
'homePage' => 'icondashboard.view',
// Enable/Disable Single Logout
'slo' => true,
// Attribute mapping between XIBO-CMS and the IdP
'mapping' => [
'UserID' => '',
'usertypeid' => '',
'UserName' => 'uid',
'email' => 'mail',
],
// Initial User Group
'group' => 'Users',
// Group Assignments
'matchGroups' => [
'enabled' => false,
'attribute' => null,
'extractionRegEx' => null,
],
],
// Settings for the PHP-SAML toolkit.
// See documentation: https://github.com/onelogin/php-saml#settings
'strict' => false,
'debug' => true,
'idp' => [
'entityId' => 'https://idp.example.com/simplesaml/saml2/idp/metadata.php',
'singleSignOnService' => [
'url' => 'http://idp.example.com/simplesaml/saml2/idp/SSOService.php',
],
'singleLogoutService' => [
'url' => 'http://idp.example.com/simplesaml/saml2/idp/SingleLogoutService.php',
],
'x509cert' => '',
],
'sp' => [
'entityId' => 'http://xibo-cms.example.com/saml/metadata',
'assertionConsumerService' => [
'url' => 'http://xibo-cms.example.com/saml/acs',
],
'singleLogoutService' => [
'url' => 'http://xibo-cms.example.com/saml/sls',
],
'NameIDFormat' => 'urn:oasis:names:tc:SAML:2.0:nameid-format:emailAddress',
'x509cert' => '',
'privateKey' > '',
,
'security' => [
'nameIdEncrypted' => false,
'authnRequestsSigned' => false,
'logoutRequestSigned' => false,
'logoutResponseSigned' => false,
'signMetadata' => false,
'wantMessagesSigned' => false,
'wantAssertionsSigned' => false,
'wantAssertionsEncrypted' => false,
'wantNameIdEncrypted' => false,
],
];
*/
14 changes: 13 additions & 1 deletion lib/Connector/PixabayConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ public function onLibraryProvider(LibraryProviderEvent $event)
$searchResult->type = 'video';
$searchResult->thumbnail = $result->videos->tiny->url;
$searchResult->duration = $result->duration;
$searchResult->videoThumbnailUrl = str_replace('pictureId', $result->picture_id, 'https://i.vimeocdn.com/video/pictureId_960x540.png');
if (!empty($result->videos->large)) {
$searchResult->download = $result->videos->large->url;
$searchResult->width = $result->videos->large->width;
Expand All @@ -210,6 +209,19 @@ public function onLibraryProvider(LibraryProviderEvent $event)
$searchResult->height = $result->videos->tiny->height;
$searchResult->fileSize = $result->videos->tiny->size;
}

if (!empty($result->picture_id ?? null)) {
// Try the old way (at some point this stopped working and went to the thumbnail approach above
$searchResult->videoThumbnailUrl = str_replace(
'pictureId',
$result->picture_id,
'https://i.vimeocdn.com/video/pictureId_960x540.png'
);
} else {
// Use the medium thumbnail if we have it, otherwise the tiny one.
$searchResult->videoThumbnailUrl = $result->videos->medium->thumbnail
?? $result->videos->tiny->thumbnail;
}
} else {
$searchResult->type = 'image';
$searchResult->thumbnail = $result->previewURL;
Expand Down
53 changes: 50 additions & 3 deletions lib/Controller/Folder.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*
* Copyright (C) 2023 Xibo Signage Ltd
* Copyright (C) 2024 Xibo Signage Ltd
*
* Xibo - Digital Signage - https://xibosignage.com
*
Expand Down Expand Up @@ -69,6 +69,34 @@ public function displayPage(Request $request, Response $response)
* tags={"folder"},
* summary="Search Folders",
* description="Returns JSON representation of the Folder tree",
* @SWG\Parameter(
* name="folderId",
* in="path",
* description="Show usage details for the specified Folder Id",
* type="integer",
* required=false
* ),
* @SWG\Parameter(
* name="gridView",
* in="query",
* description="Flag (0, 1), Show Folders in a standard grid response",
* type="integer",
* required=false
* ),
* @SWG\Parameter(
* name="folderId",
* in="query",
* description="Use with gridView, Filter by Folder Id",
* type="integer",
* required=false
* ),
* @SWG\Parameter(
* name="folderName",
* in="query",
* description="Use with gridView, Filter by Folder name",
* type="string",
* required=false
* ),
* @SWG\Response(
* response=200,
* description="successful operation",
Expand All @@ -86,8 +114,19 @@ public function displayPage(Request $request, Response $response)
public function grid(Request $request, Response $response, $folderId = null)
{
$params = $this->getSanitizer($request->getParams());
// Should we return information for a specific folder?
if ($folderId !== null) {
if ($params->getInt('gridView') === 1) {
$folders = $this->folderFactory->query($this->gridRenderSort($params), $this->gridRenderFilter([
'folderName' => $params->getString('folderName'),
'folderId' => $params->getInt('folderId'),
], $params));

$this->getState()->template = 'grid';
$this->getState()->recordsTotal = $this->folderFactory->countLast();
$this->getState()->setData($folders);

return $this->render($request, $response);
} else if ($folderId !== null) {
// Should we return information for a specific folder?
$folder = $this->folderFactory->getById($folderId);

$this->decorateWithButtons($folder);
Expand Down Expand Up @@ -342,6 +381,14 @@ public function delete(Request $request, Response $response, $folderId)
);
}

if ($folder->id == $this->getConfig()->getSetting('DISPLAY_DEFAULT_FOLDER')) {
throw new InvalidArgumentException(
__('Cannot remove Folder set as default Folder for new Displays'),
'folderId',
__('Change Default Folder for new Displays before deleting')
);
}

try {
$folder->delete();
} catch (\Exception $exception) {
Expand Down
16 changes: 15 additions & 1 deletion lib/Controller/Settings.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*
* Copyright (C) 2023 Xibo Signage Ltd
* Copyright (C) 2024 Xibo Signage Ltd
*
* Xibo - Digital Signage - https://xibosignage.com
*
Expand Down Expand Up @@ -431,6 +431,20 @@ public function update(Request $request, Response $response)
$this->getConfig()->changeSetting('DISPLAY_AUTO_AUTH', $sanitizedParams->getCheckbox('DISPLAY_AUTO_AUTH'));
}

if ($this->getConfig()->isSettingEditable('DISPLAY_DEFAULT_FOLDER')) {
$this->handleChangedSettings(
'DISPLAY_DEFAULT_FOLDER',
$this->getConfig()->getSetting('DISPLAY_DEFAULT_FOLDER'),
$sanitizedParams->getInt('DISPLAY_DEFAULT_FOLDER'),
$changedSettings
);
$this->getConfig()->changeSetting(
'DISPLAY_DEFAULT_FOLDER',
$sanitizedParams->getInt('DISPLAY_DEFAULT_FOLDER'),
1
);
}

if ($this->getConfig()->isSettingEditable('HELP_BASE')) {
$this->handleChangedSettings('HELP_BASE', $this->getConfig()->getSetting('HELP_BASE'), $sanitizedParams->getString('HELP_BASE'), $changedSettings);
$this->getConfig()->changeSetting('HELP_BASE', $sanitizedParams->getString('HELP_BASE'));
Expand Down
27 changes: 24 additions & 3 deletions lib/Entity/Display.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*
* Copyright (C) 2023 Xibo Signage Ltd
* Copyright (C) 2024 Xibo Signage Ltd
*
* Xibo - Digital Signage - https://xibosignage.com
*
Expand Down Expand Up @@ -977,8 +977,29 @@ private function add()
$displayGroup->tags = $this->tags;

// this is added from xmds, by default new displays will end up in root folder.
$displayGroup->folderId = 1;
$displayGroup->permissionsFolderId = 1;
// Can be overridden per DISPLAY_DEFAULT_FOLDER setting
$folderId = $this->folderId ?? 1;

// If folderId is not set to Root Folder
// We need to check what permissionsFolderId should be set on the Display Group
if ($folderId !== 1) {
// just in case protect against no longer existing Folder.
try {
$folder = $this->folderFactory->getById($folderId, 0);

$displayGroup->folderId = $folder->getId();
$displayGroup->permissionsFolderId = $folder->getPermissionFolderIdOrThis();
} catch (NotFoundException $e) {
$this->getLog()->error('Display Default Folder no longer exists');

// if the Folder from settings no longer exists, default to Root Folder.
$displayGroup->folderId = 1;
$displayGroup->permissionsFolderId = 1;
}
} else {
$displayGroup->folderId = 1;
$displayGroup->permissionsFolderId = 1;
}

$displayGroup->setDisplaySpecificDisplay($this);

Expand Down
Loading

0 comments on commit 33d8176

Please sign in to comment.