From 72437fb65219223a255fc03096d3c959403f591d Mon Sep 17 00:00:00 2001 From: Steffen Kamper <info@sk-typo3.de> Date: Wed, 17 Nov 2010 11:30:21 +0000 Subject: [PATCH] Fixed bug #16320: Prepare userauthgroup to support custom staging (Thanks to Tolleiv Nietsch) git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@9442 709f56b5-9817-0410-a4d7-c38de5d9e867 --- ChangeLog | 1 + t3lib/class.t3lib_userauthgroup.php | 34 ++++++++++++++++++++++++----- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 53442a661afc..a9cb62227252 100755 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ 2010-11-17 Steffen Kamper <steffen@typo3.org> + * Fixed bug #16320: Prepare userauthgroup to support custom staging (Thanks to Tolleiv Nietsch) * Fixed bug #16436: Call to undefined method SC_mod_tools_em_index::uploadExtensionToTER() 2010-11-17 Jochen Rau <jochen.rau@typoplanet.de> diff --git a/t3lib/class.t3lib_userauthgroup.php b/t3lib/class.t3lib_userauthgroup.php index fe82127526c7..cd89783abf5b 100644 --- a/t3lib/class.t3lib_userauthgroup.php +++ b/t3lib/class.t3lib_userauthgroup.php @@ -878,11 +878,35 @@ class t3lib_userAuthGroup extends t3lib_userAuth { if ($this->workspace>0) { $stat = $this->checkWorkspaceCurrent(); - $memberStageLimit = $this->workspaceRec['review_stage_edit'] ? 1 : 0; - if (($stage<=$memberStageLimit && $stat['_ACCESS']==='member') || - ($stage<=1 && $stat['_ACCESS']==='reviewer') || - ($stat['_ACCESS']==='owner')) { - return TRUE; // OK for these criteria + + // Check if custom staging is activated + $workspaceRec = t3lib_BEfunc::getRecord('sys_workspace', $stat['uid']); + if ($workspaceRec['custom_stages'] > 0 && $stage !== '0' && $stage !== '-10') { + + // Get custom stage record + $workspaceStageRec = t3lib_BEfunc::getRecord('sys_workspace_stage', $stage); + // Check if the user is responsible for the current stage + if ((t3lib_div::inList($workspaceStageRec['responsible_persons'], 'be_users_' . $this->user['uid']) + && $stat['_ACCESS'] === 'member') + || $stat['_ACCESS'] === 'owner') { + return TRUE; // OK for these criteria + } + + // Check if the user is in a group which is responsible for the current stage + foreach ($this->userGroupsUID as $groupUid) { + if ((t3lib_div::inList($workspaceStageRec['responsible_persons'], 'be_groups_' . $groupUid) + && $stat['_ACCESS'] === 'member') + || $stat['_ACCESS'] === 'owner') { + return TRUE; // OK for these criteria + } + } + } else { + $memberStageLimit = $this->workspaceRec['review_stage_edit'] ? 1 : 0; + if (($stage <= $memberStageLimit && $stat['_ACCESS'] === 'member') + || ($stage <= 1 && $stat['_ACCESS'] === 'reviewer') + || $stat['_ACCESS'] === 'owner') { + return TRUE; // OK for these criteria + } } } else return TRUE; // Always OK for live and draft workspaces. } -- GitLab