Fixed bug #12308: Workspace non-admin not workspace owner sees icon to swap updated...
authortolleiv <tolleiv@743128fe-103e-dd11-99c4-001b210b3e58>
Fri, 21 Jan 2011 09:43:14 +0000 (09:43 +0000)
committertolleiv <tolleiv@743128fe-103e-dd11-99c4-001b210b3e58>
Fri, 21 Jan 2011 09:43:14 +0000 (09:43 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/CoreProjects/workspaces/workspaces/trunk@3913 743128fe-103e-dd11-99c4-001b210b3e58

typo3/sysext/workspaces/ChangeLog
typo3/sysext/workspaces/Classes/Service/GridData.php

index 7ed5211..685d2ef 100644 (file)
@@ -1,5 +1,6 @@
 2011-01-21  Tolleiv Nietsch <typo3@tolleiv.de>
 
+       * Fixed bug #12308: Workspace non-admin not workspace owner sees icon to swap updated version with Live site
        * Fixed bug #12384: Mount points are not taken into account in element-list
        * Fixed bug #12325: Hide icons that don't work in the current context
        * Fixed bug #11539: Split view
index 6d54b62..557de62 100644 (file)
@@ -86,6 +86,11 @@ class tx_Workspaces_Service_GridData {
                $workspacesObj = t3lib_div::makeInstance('Tx_Workspaces_Service_Workspaces');
                $availableWorkspaces = $workspacesObj->getAvailableWorkspaces();
 
+               $workspaceAccess = $GLOBALS['BE_USER']->checkWorkspace($GLOBALS['BE_USER']->workspace);
+               $swapStage = ($workspaceAccess['publish_access'] & 1) ? Tx_Workspaces_Service_Stages::STAGE_PUBLISH_ID : 0;
+               $swapAccess =  $GLOBALS['BE_USER']->workspacePublishAccess($GLOBALS['BE_USER']->workspace) &&
+                                          $GLOBALS['BE_USER']->workspaceSwapAccess();
+
                $this->initializeWorkspacesCachingFramework();
 
                // check for dataArray in cache
@@ -129,8 +134,14 @@ class tx_Workspaces_Service_GridData {
 
                                        $versionArray['allowedAction_nextStage'] = $stagesObj->isNextStageAllowedForUser($versionRecord['t3ver_stage']);
                                        $versionArray['allowedAction_prevStage'] = $stagesObj->isPrevStageAllowedForUser($versionRecord['t3ver_stage']);
-                                               // @todo hide the actions if the user is not allowed to edit the current stage
-                                       $versionArray['allowedAction_swap'] = $GLOBALS['BE_USER']->workspaceSwapAccess();
+
+                                       if ($swapAccess && $swapStage != 0 && $versionRecord['t3ver_stage'] == $swapStage) {
+                                               $versionArray['allowedAction_swap'] = $stagesObj->isNextStageAllowedForUser($swapStage);
+                                       } else if ($swapAccess && $swapStage == 0) {
+                                               $versionArray['allowedAction_swap'] = TRUE;
+                                       } else {
+                                               $versionArray['allowedAction_swap'] = FALSE;
+                                       }
                                        $versionArray['allowedAction_delete'] = TRUE;
                                                // preview and editing of a deleted page won't work ;)
                                        $versionArray['allowedAction_view'] = !$isDeletedPage && $viewUrl;