Skip to content
Merged

V13 #17

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 4.0.1 (2025-07-22)
[TASK] use Configuration/page.tsconfig for template overrides
[TASK] raise version number to 4.0.1

## 4.0.0 (2025-06-16)
[TASK] TYPO3 13.4 compatibility

## 3.0.0 (2022-12-14)

[TASK] Add actions + small php fixes
Expand Down
63 changes: 0 additions & 63 deletions Classes/Hooks/RecordListGetTableHook.php

This file was deleted.

11 changes: 4 additions & 7 deletions Classes/ViewHelpers/UserHasWritePermissionForPageViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,16 @@

namespace Visol\PowermailExportperms\ViewHelpers;

use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Http\ServerRequestFactory;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;

class UserHasWritePermissionForPageViewHelper extends AbstractViewHelper
{

/**
* @return bool
*/
public function render(): bool
{
$currentPageUid = (int)GeneralUtility::_GET('id');
$request = ServerRequestFactory::fromGlobals();
$currentPageUid = (int) ($request->getQueryParams()['id'] ?? 0);
// 16 = permission to edit content on the page
if (!$GLOBALS['BE_USER']->doesUserHaveAccess(BackendUtility::getRecord('pages', $currentPageUid), 16)) {
// user does not have permission to edit contents on this page
Expand Down
2 changes: 2 additions & 0 deletions Configuration/page.tsconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# override backend templates. Config is setting $GLOBALS['TYPO3_CONF_VARS']['BE']['defaultPageTSconfig']
templates.in2code/powermail.1752658658 = visol/powermail-exportperms:Resources/Private/TemplateOverrides
50 changes: 15 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,22 @@ Powermail Export Permissions
============================

By default, an editor who has read access to a page in TYPO3, access to Powermail mails and answers and permissions to
use the Powermail module can read and export the submitted form data. If you're working with a page where every editor
can see every page but only edit those he has permissions for, this might not be desirable.
use the Powermail module can read and export the submitted form data. If you're working with a page where every editor
can see every page but only edit those he has permissions for, this might not be desirable.

This simple extension hooks into the Powermail and the List module and check for write access to the page. If there is
no write access, the mails cannot be exported.
no write access, the mails cannot be exported.

## Compatibility and Maintenance

This package is currently maintained for the following versions:

| TYPO3 Version | Package Version | Branch | Maintained |
|-----------------------|-----------------|---------|---------------|
| TYPO3 11.5.x | 3.x | master | Yes |
| TYPO3 8.7.x | 2.x | - | No |
| TYPO3 6.2.x | 1.x | - | No |
| TYPO3 Version | Package Version | Branch | Maintained |
|---------------|-----------------|--------|------------|
| TYPO3 13.4.x | 4.x | master | Yes |
| TYPO3 11.5.x | 3.x | v11 | No |
| TYPO3 8.7.x | 2.x | - | No |
| TYPO3 6.2.x | 1.x | - | No |

Installation
------------
Expand All @@ -31,43 +32,22 @@ Usage
The list view doesn't display records from the tables tx_powermail_domain_model_mails and tx_powermail_domain_model answers
if the user doesn't have at least content editing permissions on a page. This is done by using a hook in the TYPO3 core.

To use this functionality in the Powermail backend module, copy the backend templates to your template extension (or anywhere you want)
and configure the module to use them:
The template `typo3/vendor/in2code/powermail/Resources/Private/Templates/Module/List.html` will be overridden by
[powermail_exportperms/Resources/Private/TemplateOverrides/Templates/Module/List.html](./Resources/Private/TemplateOverrides/Templates/Module/List.html)

module.tx_powermail {
view {
templateRootPath = path/to/Templates
partialRootPath = path/to/Partials
layoutRootPath = path/to/Layouts
}
}

Then, import the namespace of the extension's ViewHelper:

{namespace pmep=Visol\PowermailExportperms\ViewHelpers}

And wrap whatever you want to show and hide depending on the editing rights with an if condition using the UserHasWritePermissionForPage ViewHelper:

<f:if condition="{pmep:userHasWritePermissionForPage()}">
<f:then>
[Show stuff]
</f:then>
<f:else>
Access denied.
</f:else>
</f:if>
by `$GLOBALS['TYPO3_CONF_VARS']['BE']['defaultPageTSconfig'] .= chr(10) . 'templates.in2code/powermail.1752658658 = visol/powermail-exportperms:Resources/Private/TemplateOverrides';` defined in [ext_localconf.php](./ext_localconf.php)


Security considerations
-----------------------

Be aware that this extension merely hides records from the user. It does not prevent fetching the records with other views
providing database listing or by manipulating URL parameters from the edit/show record functionalities in the TYPO3 backend.
providing database listing or by manipulating URL parameters from the edit/show record functionalities in the TYPO3 backend.

Do not use the extension if you are obliged to make the records completely inaccessible for a user.

Requirements
------------

* TYPO3 8.7 LTS+
* Tested with Powermail 5.3
* TYPO3 13 LTS+
* Tested with Powermail 13
12 changes: 12 additions & 0 deletions Resources/Private/Language/de.locallang.xlf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" target-language="de" datatype="plaintext" original="messages" date="2025-07-16T10:40:22+0000" product-name="powermail_exportperms">
<header/>
<body>
<trans-unit id="permission.info.description" xml:space="preserve">
<source>Only visible if editor owns appropriate edit rights on the selected page.</source>
<target>Nur sichtbar für Editor*innen, die über Schreibrechte auf der ausgewählten Seite verfügen.</target>
</trans-unit>
</body>
</file>
</xliff>
14 changes: 14 additions & 0 deletions Resources/Private/Language/locallang.xlf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="messages" date="2025-07-16T10:40:22+0000" product-name="powermail_exportperms">
<header/>
<body>
<trans-unit id="permission.info.description" xml:space="preserve">
<source>Only visible if editor owns appropriate edit rights on the selected page.</source>
</trans-unit>
<trans-unit id="permission.denied.description" xml:space="preserve">
<source>Only visible if editor owns appropriate edit rights on the selected page.</source>
</trans-unit>
</body>
</file>
</xliff>
81 changes: 81 additions & 0 deletions Resources/Private/TemplateOverrides/Templates/Module/List.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{namespace pmep=Visol\PowermailExportperms\ViewHelpers}
<html
xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
xmlns:core="http://typo3.org/ns/TYPO3/CMS/Core/ViewHelpers"
xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers"
data-namespace-typo3-fluid="true">

<f:layout name="Module" />

Show Backend Module: Powermail List

<f:section name="Content">

<f:if condition="{pmep:userHasWritePermissionForPage()}">
<f:then>
<f:render partial="Module/JsAndCssImport" arguments="{_all}" />

<h1><f:translate key="BackendListTitle" /></h1>

<div class="callout callout-info">
<div class="callout-icon">
<span class="icon-emphasized">
<span class="t3js-icon icon icon-size-small icon-state-default icon-actions-info" data-identifier="actions-info" aria-hidden="true">
<span class="icon-markup">
<svg class="icon-color"><use xlink:href="/_assets/1ee1d3e909b58d32e30dcea666dd3224/Icons/T3Icons/sprites/actions.svg#actions-info"></use></svg>
</span>
</span>
</span>
</div>
<div class="callout-content">
<div class="callout-body">
<f:translate key="LLL:EXT:powermail_exportperms/Resources/Private/Language/locallang.xlf:permission.info.description"/>
</div>
</div>
</div>

<f:comment>
Filter Area
</f:comment>
<f:alias map="{forwardToAction: 'list'}">
<f:render partial="Module/Filter" arguments="{_all}" />
</f:alias>

<div class="powermail_list">
<f:if condition="{mails}">
<f:then>
<f:render partial="Module/List" arguments="{_all}" />
<f:render partial="Module/SelectedLineMessage" arguments="{_all}" />
<f:render partial="Module/Pagination" arguments="{pagination: pagination.pagination, paginator: pagination.paginator}" />
</f:then>
<f:else>
<h3><f:translate key="BackendListNoMails" /></h3>
<p><f:translate key="BackendListNoMailsSub" /></p>
</f:else>
</f:if>
</div>
</f:then>
<f:else>
<div class="callout callout-notice">
<div class="callout-icon">
<span class="icon-emphasized">
<span class="t3js-icon icon icon-size-small icon-state-default icon-actions-lock" data-identifier="actions-lock" aria-hidden="true">
<span class="icon-markup">
<svg class="icon-color"><use xlink:href="/_assets/1ee1d3e909b58d32e30dcea666dd3224/Icons/T3Icons/sprites/actions.svg#actions-lock"></use></svg>
</span>
</span>
</span>
</div>
<div class="callout-content">
<div class="callout-title">Datensatzinformationen</div>
<div class="callout-body">
<f:translate key="LLL:EXT:powermail_exportperms/Resources/Private/Language/locallang.xlf:permission.info.description"/>
</div>
</div>
</div>
</f:else>
</f:if>

</f:section>

</html>
Binary file removed Resources/Public/Icons/Extension.gif
Binary file not shown.
1 change: 1 addition & 0 deletions Resources/Public/Icons/Extension.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 22 additions & 20 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
{
"name": "visol/powermail-exportperms",
"type": "typo3-cms-extension",
"description": "Powermail Export Permissions",
"homepage": "https://github.com/visol/ext-powermail_exportperms",
"license": [
"GPL-2.0-or-later"
],
"extra": {
"typo3/cms": {
"extension-key": "powermail_exportperms"
}
},
"autoload": {
"psr-4": {
"Visol\\PowermailExportperms\\": "Classes"
}
},
"require": {
"typo3/cms-core": "^11.5"
}
"name": "visol/powermail-exportperms",
"version": "4.0.1",
"type": "typo3-cms-extension",
"description": "Powermail Export Permissions",
"homepage": "https://github.com/visol/ext-powermail_exportperms",
"license": [
"GPL-2.0-or-later"
],
"extra": {
"typo3/cms": {
"extension-key": "powermail_exportperms"
}
},
"autoload": {
"psr-4": {
"Visol\\PowermailExportperms\\": "Classes"
}
},
"require": {
"typo3/cms-core": "^13.4",
"in2code/powermail": "^13.0"
}
}
Binary file removed ext_icon.gif
Binary file not shown.
7 changes: 2 additions & 5 deletions ext_localconf.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
<?php
use Visol\PowermailExportperms\Hooks\RecordListGetTableHook;

if (!defined('TYPO3')) {
die ('Access denied.');
die('Access denied.');
}

// Implement the getTable hook in the RecordList to manipulate the result of the query if the user doesn't have permission
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['getTable']['powermail_exportperms'] = RecordListGetTableHook::class;