├── registration.php
├── etc
├── module.xml
├── di.xml
├── acl.xml
└── adminhtml
│ └── system.xml
├── composer.json
├── LICENSE
├── Helper
└── Configuration.php
├── Block
└── Adminhtml
│ └── Form
│ └── Field
│ ├── TypeColumn.php
│ └── Policies.php
├── README.md
├── Model
└── Source
│ └── Type.php
└── Plugin
└── CspWhitelist.php
/registration.php:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ctidigital/magento2-csp-whitelist",
3 | "version": "1.0.1",
4 | "description": "Control CSP via the admin area",
5 | "type": "magento2-module",
6 | "license": [
7 | "MIT"
8 | ],
9 | "autoload": {
10 | "files": [
11 | "registration.php"
12 | ],
13 | "psr-4": {
14 | "CtiDigital\\CspWhitelist\\": ""
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/etc/di.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | Magento\Csp\Model\Collector\CspWhitelistXml\Data
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/etc/acl.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 CTI Digital
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Helper/Configuration.php:
--------------------------------------------------------------------------------
1 | serialize = $serialize;
27 | parent::__construct($context);
28 | }
29 |
30 | /**
31 | * check to see if module is enabled
32 | *
33 | * @return bool
34 | */
35 | public function isEnabled(): bool
36 | {
37 | return $this->scopeConfig->isSetFlag(self::CONFIG_ENABLE);
38 | }
39 |
40 | /**
41 | * get a list of policies
42 | *
43 | * @return array
44 | */
45 | public function getPolicies(): array
46 | {
47 | $data = [];
48 | $policies = $this->scopeConfig->getValue(self::CONFIG_POLICIES);
49 | if (!$policies) {
50 | return $data;
51 | }
52 | foreach ($this->serialize->unserialize($policies) as $policy) {
53 | $data[$policy['policy']][] = $policy['value'];
54 | }
55 | return $data;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/Block/Adminhtml/Form/Field/TypeColumn.php:
--------------------------------------------------------------------------------
1 | type = $type;
26 | parent::__construct($context, $data);
27 | }
28 |
29 | /**
30 | * Set "name" for