Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into sitemapxml_multisit…
Browse files Browse the repository at this point in the history
…es_languages

# Conflicts:
#	.github/workflows/main-ci.yaml
  • Loading branch information
mohamed-larbi-jebari committed Sep 25, 2024
2 parents 1afa9d1 + a84773e commit 9ab75f9
Show file tree
Hide file tree
Showing 22 changed files with 162 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .ddev/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ web_environment:
- PANTHER_CHROME_ARGUMENTS='--disable-dev-shm-usage --ignore-certificate-errors'
- PANTHER_NO_SANDBOX=1
- PANTHER_NO_HEADLESS=0
nodejs_version: "16"
nodejs_version: "18"
webimage_extra_packages:
- pngquant
- jpegoptim
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/main-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ jobs:
strategy:
matrix:
include:
- ibexa_version: 4.6.7
php: 8.1
node: 18.x
- ibexa_version: 4.5.*
php: 8.1
node: 14.x
Expand Down
2 changes: 1 addition & 1 deletion bin/ci-should
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ $requiredIbexaVersion = $config['required_ibexa_version'] ?? null;
if ( $requiredIbexaVersion && $ibexaVersion )
{
if(!Semver::satisfies( $ibexaVersion, $requiredIbexaVersion )) {
exit( 0 );
exit( 1 );
}
}
exit( ( $config[$action] ?? false ) === true ? 0 : 1 );
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
menu_manager: Menu manager
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
menu_manager: Gestion des menus
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data)
$metasData = $data->value->metas;
foreach ($metasConfig as $key => $meta) {
$content = isset($metasData[$key]) ? $metasData[$key]->getContent() : null;
$fieldType = $meta['type'];
$fieldType = $meta['type'] ?? 'text';
if (isset($metasData[$key]) && '' != $metasData[$key]->getFieldType()) {
$fieldType = $metasData[$key]->getFieldType();
}
Expand Down
19 changes: 16 additions & 3 deletions components/SEOBundle/bundle/Core/MetaNameSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
use Ibexa\Core\Repository\Mapper\ContentTypeDomainMapper;
use Ibexa\Core\Repository\Values\Content\VersionInfo;
use Ibexa\FieldTypeRichText\FieldType\RichText\Value as RichTextValue;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;

class MetaNameSchema extends NameSchemaService
{
Expand Down Expand Up @@ -82,6 +83,7 @@ class MetaNameSchema extends NameSchemaService
public function __construct(
ContentTypeHandler $contentTypeHandler,
FieldTypeRegistry $fieldTypeRegistry,
EventDispatcherInterface $eventDispatcher,
ContentLanguageHandler $languageHandler,
RepositoryInterface $repository,
TranslationHelper $translationHelper,
Expand All @@ -93,10 +95,10 @@ public function __construct(
$handler = new ContentTypeDomainMapper(
$contentTypeHandler,
$languageHandler,
$this->fieldTypeRegistry
$fieldTypeRegistry
);

parent::__construct($contentTypeHandler, $handler, $fieldTypeRegistry, $settings);
parent::__construct($contentTypeHandler, $handler, $fieldTypeRegistry, $eventDispatcher, $settings);

$this->repository = $repository;
$this->translationHelper = $translationHelper;
Expand All @@ -119,7 +121,7 @@ public function resolveMeta(Meta $meta, Content $content, ContentType $contentTy
{
$languages = $this->configurationResolver->getParameter('languages');

$resolveMultilingue = $this->resolve(
$resolveMultilingue = $this->resolveNameSchema(
$meta->getContent(),
$content->getContentType(),
$content->fields,
Expand Down Expand Up @@ -335,4 +337,15 @@ protected function handleImageAssetValue(ImageAssetValue $value, $fieldDefinitio

return '';
}

/**
* Override native function as this prevent usage of `()` inside metas in Ibexa 4.6
* {@inheritDoc}
*/
protected function filterNameSchema(string $nameSchema): array
{
$groupLookupTable = [];

return [$nameSchema, $groupLookupTable];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public function prepend(ContainerBuilder $container): void
'wildcard_routing.yml' => 'ibexa',
'ez_field_templates.yml' => 'ibexa',
'variations.yml' => 'ibexa',
'ibexa.yaml' => 'ibexa',
'admin_ui/ez_field_templates.yml' => 'ibexa',
'ibexa_locale_conversion.yml' => 'ibexa',
];
Expand Down
8 changes: 5 additions & 3 deletions components/SEOBundle/bundle/Form/Type/MetaType.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
class MetaType extends AbstractType
{
protected SeoMetadataFieldTypeRegistry $metadataFieldTypeRegistry;
private ConfigResolverInterface $configResolver;
protected ConfigResolverInterface $configResolver;

/**
* Constructor.
Expand Down Expand Up @@ -63,8 +63,10 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
$novaEzseo = $this->configResolver->getParameter('fieldtype_metas', 'nova_ezseo');
if (isset($novaEzseo[$builder->getName()])) {
$config = $novaEzseo[$builder->getName()];
$type = $config['type'];
$options = array_merge($options, $config['params']);
$type = $config['type'] ?? $type;
if ('select' === $type) {
$options = array_merge($options, $config['params']);
}
}

$constraints = $this->getConstraints($config);
Expand Down
7 changes: 7 additions & 0 deletions components/SEOBundle/bundle/Resources/config/ibexa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
orm:
entity_mappings:
NovaeZSEOBundle:
is_bundle: true
type: annotation
dir: Entity
prefix: Novactive\Bundle\eZSEOBundle\Entity
1 change: 1 addition & 0 deletions components/SEOBundle/ci-config.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
install: true
test: true
required_ibexa_version: ^4.6
5 changes: 3 additions & 2 deletions components/SEOBundle/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@
"MIT"
],
"require": {
"php": "^7.3 || ^8.0",
"php": "^7.4 || ^8.0",
"ext-dom": "*",
"ext-pdo": "*",
"ext-json": "*"
"ext-json": "*",
"ibexa/core": "^4.6"
},
"autoload": {
"psr-4": {
Expand Down
28 changes: 26 additions & 2 deletions components/SamlBundle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,32 @@ env(SAML_IDENTITY_PROVIDER_EMAIL_ATTRIBUTE): ~
env(SAML_IDENTITY_PROVIDER_LOGIN_ATTRIBUTE): ~
```

These variables are used to define the following global configuration :
```
idp:
entityId: '%env(resolve:SAML_IDENTITY_PROVIDER_ENTITYID)%'
singleSignOnService:
url: '%env(resolve:SAML_IDENTITY_PROVIDER_LOGIN_URL)%'
binding: '%env(resolve:SAML_IDENTITY_PROVIDER_LOGIN_BINDING)%'
singleLogoutService:
url: '%env(resolve:SAML_IDENTITY_PROVIDER_LOGOUT_URL)%'
binding: '%env(resolve:SAML_IDENTITY_PROVIDER_LOGOUT_BINDING)%'
x509cert: '%env(resolve:SAML_IDENTITY_PROVIDER_X509_CERT)%'
sp:
entityId: '%env(resolve:SAML_SERVICE_PROVIDER_URL)%/saml/metadata'
assertionConsumerService:
url: '%env(resolve:SAML_SERVICE_PROVIDER_URL)%/saml/acs'
binding: 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST'
singleLogoutService:
url: '%env(resolve:SAML_SERVICE_PROVIDER_URL)%/saml/logout'
binding: 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect'
NameIDFormat: '%env(resolve:SAML_SERVICE_PROVIDER_NAMEID_FORMAT)%'
baseurl: '%env(resolve:SAML_SERVICE_PROVIDER_URL)%/saml'
debug: '%kernel.debug%'
```

To change the configuration based on siteaccess, it's possible to defined it under the folowing siteaccess aware parameter : `almaviacx.saml.<siteaccess|siteaccess_group>.auth_settings`

The following parameters are also available to tweak the behavior
```yaml
# Attribute used to get the email address from
Expand Down Expand Up @@ -78,6 +104,4 @@ almaviacx.saml.identity.provider.login.attribute:

# Change the user load method
almaviacx.saml.config.default.user_load_method: !php/const AlmaviaCX\Bundle\IbexaSaml\Security\Saml\SamlUserProvider::LOAD_METHOD_EMAIL


```
7 changes: 7 additions & 0 deletions components/SamlBundle/src/bundle/AlmaviaCXIbexaSamlBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,15 @@

namespace AlmaviaCX\Bundle\IbexaSamlBundle;

use AlmaviaCX\Bundle\IbexaSamlBundle\DependencyInjection\Compiler\LazySaml2Auth;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;

class AlmaviaCXIbexaSamlBundle extends Bundle
{
public function build(ContainerBuilder $container)
{
parent::build($container);
$container->addCompilerPass(new LazySaml2Auth());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

declare(strict_types=1);

namespace AlmaviaCX\Bundle\IbexaSamlBundle\DependencyInjection\Compiler;

use AlmaviaCX\Bundle\IbexaSaml\Security\Saml\SamlAuthFactory;
use OneLogin\Saml2\Auth;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;

class LazySaml2Auth implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition(Auth::class)) {
return;
}

$serviceDefinition = $container->getDefinition(Auth::class);
$serviceDefinition->setFactory(new Reference(SamlAuthFactory::class));
$serviceDefinition->setLazy(true);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
services:

AlmaviaCX\Bundle\IbexaSaml\Security\Saml\SamlExceptionLogger:
arguments:
- '@monolog.logger.saml'
Expand Down Expand Up @@ -31,7 +30,7 @@ services:
$userService: '@ibexa.api.service.user'
$configResolver: '@ibexa.config.resolver'

# override to make it lazy
OneLogin\Saml2\Auth:
arguments: [ '%hslavich_onelogin_saml.settings%' ]
lazy: true
AlmaviaCX\Bundle\IbexaSaml\Security\Saml\SamlAuthFactory:
arguments:
$configResolver: '@Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface'
$defaultSettings: '%hslavich_onelogin_saml.settings%'
51 changes: 51 additions & 0 deletions components/SamlBundle/src/lib/Security/Saml/SamlAuthFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php

declare(strict_types=1);

namespace AlmaviaCX\Bundle\IbexaSaml\Security\Saml;

use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface;
use Ibexa\Core\MVC\Exception\ParameterNotFoundException;
use OneLogin\Saml2\Auth;

class SamlAuthFactory
{
protected ConfigResolverInterface $configResolver;
protected array $defaultSettings;

public function __construct(
ConfigResolverInterface $configResolver,
array $defaultSettings
) {
$this->defaultSettings = $defaultSettings;
$this->configResolver = $configResolver;
}

public function __invoke(): Auth
{
$settings = $this->defaultSettings;
try {
$saSettings = $this->configResolver->getParameter('auth_settings', 'almaviacx.saml');
} catch (ParameterNotFoundException $exception) {
$saSettings = [];
}

return new Auth($this->mergeSettings($settings, $saSettings));
}

protected function mergeSettings(array $defaultSettings, array $settings): array
{
foreach ($defaultSettings as $key => $setting) {
if (!isset($settings[$key])) {
continue;
}
if (is_array($setting)) {
$defaultSettings[$key] = $this->mergeSettings($defaultSettings[$key], $settings[$key]);
} else {
$defaultSettings[$key] = $settings[$key];
}
}

return $defaultSettings;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
solr_admin: Solr
solr_admin.resources: Manage Synonyms/Stopwords
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
solr_admin: Solr
solr_admin.resources: Gestion des synonymes/mots vides
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ public function canVisit(Criterion $criterion): bool
*/
public function visit(Criterion $criterion, CriterionVisitor $subVisitor = null): string
{
$stringQuery = strtr($subVisitor->visit($criterion->criterion), ['(' => '', ')' => '']);
$stringQuery = $subVisitor->visit($criterion->criterion);
$stringQuery = trim($stringQuery, '()');

return '{!tag='.$criterion->tag.'}('.$stringQuery.')';
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ibexa.translation.ui.label: Translations UI
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ibexa.translation.ui.label: Gestion des traductions

0 comments on commit 9ab75f9

Please sign in to comment.