Skip to content

Commit e32fb0f

Browse files
committed
Implemented Policy provider
1 parent 3ed7a2b commit e32fb0f

File tree

5 files changed

+46
-1
lines changed

5 files changed

+46
-1
lines changed

bundle/NetgenInformationCollectionBundle.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace Netgen\Bundle\InformationCollectionBundle;
44

5+
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\EzPublishCoreExtension;
6+
use Netgen\Bundle\InformationCollectionBundle\PolicyProvider\InformationCollectionPolicyProvider;
57
use Netgen\Bundle\InformationCollectionBundle\DependencyInjection\Compiler\ActionsPass;
68
use Netgen\Bundle\InformationCollectionBundle\DependencyInjection\Compiler\CustomFieldHandlersPass;
79
use Netgen\Bundle\InformationCollectionBundle\DependencyInjection\Compiler\FieldAnonymizerVisitorPass;
@@ -20,5 +22,10 @@ public function build(ContainerBuilder $container)
2022
$container->addCompilerPass(new ActionsPass());
2123
$container->addCompilerPass(new CustomFieldHandlersPass());
2224
$container->addCompilerPass(new FieldAnonymizerVisitorPass());
25+
26+
$eZExtension = $container->getExtension('ezpublish');
27+
if ($eZExtension instanceof EzPublishCoreExtension) {
28+
$eZExtension->addPolicyProvider(new InformationCollectionPolicyProvider());
29+
}
2330
}
2431
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
namespace Netgen\Bundle\InformationCollectionBundle\PolicyProvider;
4+
5+
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\ConfigBuilderInterface;
6+
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Security\PolicyProvider\PolicyProviderInterface;
7+
8+
class InformationCollectionPolicyProvider implements PolicyProviderInterface
9+
{
10+
/**
11+
* @param \eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\ConfigBuilderInterface $configBuilder
12+
*
13+
* @return array
14+
*/
15+
public function addPolicies(ConfigBuilderInterface $configBuilder)
16+
{
17+
$configBuilder->addConfig([
18+
'infocollector' => [
19+
'read' => [],
20+
'delete' => [],
21+
'anonymize' => [],
22+
'export' => [],
23+
],
24+
]);
25+
26+
return [];
27+
}
28+
}

bundle/Resources/translations/netgen_information_collection_admin.en.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ netgen_information_collection_admin_collection_no_collections_results: "Displayi
2929

3030
netgen_information_collection_admin_view_title: 'Collection #%collection_id% for %content_name%'
3131
netgen_information_collection_admin_view_subtitle: 'Last modified: %date%, %user_name%'
32+
netgen_information_collection_admin_view_download: 'Download link'
3233
netgen_information_collection_admin_view_delete: 'Delete'
3334
netgen_information_collection_admin_view_anonymize: 'Anonymize'
3435
netgen_information_collection_admin_view_delete_field: 'Delete selected fields'

bundle/Resources/views/admin/view.html.twig

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@
3535
{{ ez_field_name(content, attribute.field.identifier) }}:
3636
</span>
3737
<span class="attribute-value">
38-
{{ attribute.entity.value }}
38+
{% if attribute.field.fieldTypeIdentifier == 'enhancedezbinaryfile' %}
39+
<a href="{{ path('netgen_enhancedezbinaryfile.route.download_binary_file', { 'infocollectionAttributeId': attribute.entity.id }) }}">{{ 'netgen_information_collection_admin_view_download'|trans }}: {{ attribute.field.identifier }}</a>
40+
{% else %}
41+
{{ attribute.entity.value }}
42+
{% endif %}
3943
</span>
4044
</label>
4145
</div>

doc/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ All notable changes to this project will be documented in this file.
66
The format is based on [Keep a Changelog](http://keepachangelog.com/)
77
and this project adheres to [Semantic Versioning](http://semver.org/).
88

9+
## [1.7.0] - 2020-01-24
10+
### Added
11+
- Implemented Information collection policy provider
12+
- Enabled download controller for enhanced binary file
13+
914
## [1.6.8] - 2019-04-26
1015
### Added
1116
- A bit more looser coupling to `doctrine/orm` version

0 commit comments

Comments
 (0)