[FEATURE] Access module "leave unchanged" 91/35491/3
authorBenjamin Mack <benni@typo3.org>
Mon, 15 Dec 2014 18:17:46 +0000 (19:17 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Mon, 15 Dec 2014 23:50:26 +0000 (00:50 +0100)
Allow the access module to leave a selector
as "unchanged" in order to only overwrite
permissions and not the owner/group.

Resolves: #15619
Releases: master
Change-Id: If343565f34f9909d968c54b142a0c7d12108ac18
Reviewed-on: http://review.typo3.org/35491
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/beuser/Classes/Controller/PermissionController.php
typo3/sysext/beuser/Resources/Private/Language/locallang_mod_permission.xlf
typo3/sysext/core/Documentation/Changelog/master/Feature-15619-LeaveUnchagedInAccessModule.rst [new file with mode: 0644]

index 795ab94..52781ce 100644 (file)
@@ -296,21 +296,21 @@ class PermissionController extends ActionController {
                                $beGroupArray = BackendUtility::blindGroupNames($beGroupArrayO, $beGroupKeys, 1);
                        }
 
-                       // Owner selector:
-                       $beUserDataArray = array();
-                       $beUserDataArray[0] = '';
+                       // Owner selector
+                       $beUserDataArray = array(0 => LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:selectNone', 'beuser'));
                        foreach ($beUserArray as $uid => &$row) {
                                $beUserDataArray[$uid] = $row['username'];
                        }
+                       $beUserDataArray[-1] = LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:selectUnchanged', 'beuser');
                        $this->view->assign('currentBeUser', $this->pageInfo['perms_userid']);
                        $this->view->assign('beUserData', $beUserDataArray);
 
-                       // Group selector:
-                       $beGroupDataArray = array();
-                       $beGroupDataArray[0] = '';
+                       // Group selector
+                       $beGroupDataArray = array(0 => LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:selectNone', 'beuser'));
                        foreach ($beGroupArray as $uid => $row) {
                                $beGroupDataArray[$uid] = $row['title'];
                        }
+                       $beGroupDataArray[-1] = LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:selectUnchanged', 'beuser');
                        $this->view->assign('currentBeGroup', $this->pageInfo['perms_groupid']);
                        $this->view->assign('beGroupData', $beGroupDataArray);
                        $this->view->assign('pageInfo', $this->pageInfo);
@@ -335,6 +335,13 @@ class PermissionController extends ActionController {
                if ($this->checkAccess()) {
                        if (!empty($data['pages'])) {
                                foreach ($data['pages'] as $pageUid => $properties) {
+                                       // if the owner and group field shouldn't be touched, unset the option
+                                       if ((int)$properties['perms_userid'] === -1) {
+                                               unset($properties['perms_userid']);
+                                       }
+                                       if ((int)$properties['perms_groupid'] === -1) {
+                                               unset($properties['perms_groupid']);
+                                       }
                                        $this->getDatabaseConnection()->exec_UPDATEquery(
                                                'pages',
                                                'uid = ' . (int)$pageUid,
index ca32e42..262e970 100644 (file)
                        <trans-unit id="noGroups" xml:space="preserve">
                                <source>No user groups exist.</source>
                        </trans-unit>
+                       <trans-unit id="selectNone" xml:space="preserve">
+                               <source>   - none -   </source>
+                       </trans-unit>
+                       <trans-unit id="selectUnchanged" xml:space="preserve">
+                               <source>   - leave unchanged -   </source>
+                       </trans-unit>
                </body>
        </file>
 </xliff>
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Feature-15619-LeaveUnchagedInAccessModule.rst b/typo3/sysext/core/Documentation/Changelog/master/Feature-15619-LeaveUnchagedInAccessModule.rst
new file mode 100644 (file)
index 0000000..bfb8f28
--- /dev/null
@@ -0,0 +1,9 @@
+==============================================================
+Feature: #15619 - Access module: Allow selector as "unchanged"
+==============================================================
+
+Description
+===========
+
+In order to only overwrite permissions in the access module and not the owner/group it is now possible
+to set the selector to " - leave unchanged - ".
\ No newline at end of file