diff --git a/ChangeLog b/ChangeLog index 53442a661afcd713f41407ac656c8ad3dfbdac90..a9cb6222725233459072869a7d63bc8fd708d43a 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 fe82127526c742087505776e3b420531e02f6bbc..cd89783abf5b9c779c72a4f173049b7d0c0b20d3 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. }