Method fetchGroups():
authorAndreas Otto <andreas.otto@dkd.de>
Mon, 27 Jun 2005 14:17:25 +0000 (14:17 +0000)
committerAndreas Otto <andreas.otto@dkd.de>
Mon, 27 Jun 2005 14:17:25 +0000 (14:17 +0000)
* Added hook as requested and provided by Stig N. Faerch.
*
* This hook is used by the extension 'roles'. With this hook it's possible to
* control the backend usergroup access, through manipulating a sql-sentence.
* In the case of 'roles', the hook is used to limit access to the selected
* backend usergroup (which is marked as a role). This is very powerful when
* you need to have a better overview in the backend.

git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@770 709f56b5-9817-0410-a4d7-c38de5d9e867

t3lib/class.t3lib_userauthgroup.php

index ec26979..852fa67 100755 (executable)
@@ -832,7 +832,19 @@ class t3lib_userAuthGroup extends t3lib_userAuth {
 
                        // Fetching records of the groups in $grList (which are not blocked by lockedToDomain either):
                $lockToDomain_SQL = ' AND (lockToDomain=\'\' OR lockToDomain=\''.t3lib_div::getIndpEnv('HTTP_HOST').'\')';
-               $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $this->usergroup_table, 'deleted=0 AND hidden=0 AND pid=0 AND uid IN ('.$grList.')'.$lockToDomain_SQL);
+               $whereSQL = 'deleted=0 AND hidden=0 AND pid=0 AND uid IN ('.$grList.')'.$lockToDomain_SQL;
+
+                       // Hook for manipulation of the WHERE sql sentence which controls which BE-groups are included
+               if (is_array ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauthgroup.php']['fetchGroupQuery'])) {
+                   foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauthgroup.php']['fetchGroupQuery'] as $classRef) {
+                       $hookObj = &t3lib_div::getUserObj($classRef);
+                       if(method_exists($hookObj,'fetchGroupQuery_processQuery')){
+                           $whereSQL = $hookObj->fetchGroupQuery_processQuery($this, $grList, $idList, $whereSQL);
+                       }
+                   }
+               }
+
+               $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $this->usergroup_table, $whereSQL);
 
                        // The userGroups array is filled
                while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))      {