More workspace dev.
[Packages/TYPO3.CMS.git] / t3lib / class.t3lib_userauthgroup.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
18 *
19 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27 /**
28 * Contains an extension class specifically for authentication/initialization of backend users in TYPO3
29 *
30 * $Id$
31 * Revised for TYPO3 3.6 July/2003 by Kasper Skaarhoj
32 *
33 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
34 */
35 /**
36 * [CLASS/FUNCTION INDEX of SCRIPT]
37 *
38 *
39 *
40 * 133: class t3lib_userAuthGroup extends t3lib_userAuth
41 *
42 * SECTION: Permission checking functions:
43 * 197: function isAdmin()
44 * 209: function isMemberOfGroup($groupId)
45 * 231: function doesUserHaveAccess($row,$perms)
46 * 248: function isInWebMount($id,$readPerms='',$exitOnError=0)
47 * 275: function modAccess($conf,$exitOnError)
48 * 326: function getPagePermsClause($perms)
49 * 365: function calcPerms($row)
50 * 403: function isRTE()
51 * 437: function check($type,$value)
52 * 454: function checkAuthMode($table,$field,$value,$authMode)
53 * 520: function checkLanguageAccess($langValue)
54 * 541: function recordEditAccessInternals($table,$idOrRow)
55 * 606: function isPSet($lCP,$table,$type='')
56 * 623: function mayMakeShortcut()
57 * 637: function workspaceCannotEditRecord($table,$rec)
58 * 670: function workspaceAllowLiveRecordsInPID($pid, $table)
59 * 691: function workspaceCreateNewRecord($pid, $table)
60 * 710: function workspaceAllowAutoCreation($table,$id,$recpid)
61 * 730: function workspaceCheckStageForCurrent($stage)
62 * 753: function workspacePublishAccess($wsid)
63 * 777: function workspaceSwapAccess()
64 * 789: function workspaceVersioningTypeAccess($type)
65 * 816: function workspaceVersioningTypeGetClosest($type)
66 *
67 * SECTION: Miscellaneous functions
68 * 857: function getTSConfig($objectString,$config='')
69 * 883: function getTSConfigVal($objectString)
70 * 895: function getTSConfigProp($objectString)
71 * 907: function inList($in_list,$item)
72 * 918: function returnWebmounts()
73 * 928: function returnFilemounts()
74 *
75 * SECTION: Authentication methods
76 * 959: function fetchGroupData()
77 * 1092: function fetchGroups($grList,$idList='')
78 * 1179: function setCachedList($cList)
79 * 1199: function addFileMount($title, $altTitle, $path, $webspace, $type)
80 * 1246: function addTScomment($str)
81 *
82 * SECTION: Workspaces
83 * 1282: function workspaceInit()
84 * 1325: function checkWorkspace($wsRec,$fields='uid,title,adminusers,members,reviewers')
85 * 1399: function checkWorkspaceCurrent()
86 * 1412: function setWorkspace($workspaceId)
87 * 1440: function setWorkspacePreview($previewState)
88 * 1450: function getDefaultWorkspace()
89 *
90 * SECTION: Logging
91 * 1501: function writelog($type,$action,$error,$details_nr,$details,$data,$tablename='',$recuid='',$recpid='',$event_pid=-1,$NEWid='',$userId=0)
92 * 1533: function simplelog($message, $extKey='', $error=0)
93 * 1554: function checkLogFailures($email, $secondsBack=3600, $max=3)
94 *
95 * TOTAL FUNCTIONS: 43
96 * (This index is automatically created/updated by the extension "extdeveval")
97 *
98 */
99
100 // Need this for parsing User TSconfig
101 require_once (PATH_t3lib.'class.t3lib_tsparser.php');
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123 /**
124 * Extension to class.t3lib_userauth.php; Authentication of users in TYPO3 Backend
125 *
126 * Actually this class is extended again by t3lib_beuserauth which is the actual backend user class that will be instantiated.
127 * In fact the two classes t3lib_beuserauth and this class could just as well be one, single class since t3lib_userauthgroup is not - to my knowledge - used separately elsewhere. But for historical reasons they are two separate classes.
128 *
129 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
130 * @package TYPO3
131 * @subpackage t3lib
132 */
133 class t3lib_userAuthGroup extends t3lib_userAuth {
134 var $usergroup_column = 'usergroup'; // Should be set to the usergroup-column (id-list) in the user-record
135 var $usergroup_table = 'be_groups'; // The name of the group-table
136
137 // internal
138 var $groupData = Array( // This array holds lists of eg. tables, fields and other values related to the permission-system. See fetchGroupData
139 'filemounts' => Array() // Filemounts are loaded here
140 );
141 var $workspace = -99; // User workspace. -99 is ERROR (none available), -1 is offline, 0 is online, >0 is custom workspaces.
142 var $workspaceRec = array(); // Custom workspace record if any
143
144 var $userGroups = Array(); // This array will hold the groups that the user is a member of
145 var $userGroupsUID = Array(); // This array holds the uid's of the groups in the listed order
146 var $groupList =''; // This is $this->userGroupsUID imploded to a comma list... Will correspond to the 'usergroup_cached_list'
147 var $dataLists=array( // Used internally to accumulate data for the user-group. DONT USE THIS EXTERNALLY! Use $this->groupData instead
148 'webmount_list'=>'',
149 'filemount_list'=>'',
150 'modList'=>'',
151 'tables_select'=>'',
152 'tables_modify'=>'',
153 'pagetypes_select'=>'',
154 'non_exclude_fields'=>'',
155 'explicit_allowdeny'=>'',
156 'allowed_languages' => '',
157 'workspace_perms' => '',
158 'custom_options' => '',
159 );
160 var $includeHierarchy=array(); // For debugging/display of order in which subgroups are included.
161 var $includeGroupArray=array(); // List of group_id's in the order they are processed.
162
163 var $OS=''; // Set to 'WIN', if windows
164 var $TSdataArray=array(); // Used to accumulate the TSconfig data of the user
165 var $userTS_text = ''; // Contains the non-parsed user TSconfig
166 var $userTS = array(); // Contains the parsed user TSconfig
167 var $userTSUpdated=0; // Set internally if the user TSconfig was parsed and needs to be cached.
168 var $userTS_dontGetCached=0; // Set this from outside if you want the user TSconfig to ALWAYS be parsed and not fetched from cache.
169
170 var $RTE_errors = array(); // RTE availability errors collected.
171 var $errorMsg = ''; // Contains last error message
172
173 var $checkWorkspaceCurrent_cache=NULL; // Cache for checkWorkspaceCurrent()
174
175
176
177
178
179
180
181
182
183
184
185 /************************************
186 *
187 * Permission checking functions:
188 *
189 ************************************/
190
191 /**
192 * Returns true if user is admin
193 * Basically this function evaluates if the ->user[admin] field has bit 0 set. If so, user is admin.
194 *
195 * @return boolean
196 */
197 function isAdmin() {
198 return (($this->user['admin']&1) ==1);
199 }
200
201 /**
202 * Returns true if the current user is a member of group $groupId
203 * $groupId must be set. $this->groupList must contain groups
204 * Will return true also if the user is a member of a group through subgroups.
205 *
206 * @param integer Group ID to look for in $this->groupList
207 * @return boolean
208 */
209 function isMemberOfGroup($groupId) {
210 $groupId = intval($groupId);
211 if ($this->groupList && $groupId) {
212 return $this->inList($this->groupList, $groupId);
213 }
214 }
215
216 /**
217 * Checks if the permissions is granted based on a page-record ($row) and $perms (binary and'ed)
218 *
219 * Bits for permissions, see $perms variable:
220 *
221 * 1 - Show: See/Copy page and the pagecontent.
222 * 16- Edit pagecontent: Change/Add/Delete/Move pagecontent.
223 * 2- Edit page: Change/Move the page, eg. change title, startdate, hidden.
224 * 4- Delete page: Delete the page and pagecontent.
225 * 8- New pages: Create new pages under the page.
226 *
227 * @param array $row is the pagerow for which the permissions is checked
228 * @param integer $perms is the binary representation of the permission we are going to check. Every bit in this number represents a permission that must be set. See function explanation.
229 * @return boolean True or False upon evaluation
230 */
231 function doesUserHaveAccess($row,$perms) {
232 $userPerms = $this->calcPerms($row);
233 return ($userPerms & $perms)==$perms;
234 }
235
236 /**
237 * Checks if the page id, $id, is found within the webmounts set up for the user.
238 * This should ALWAYS be checked for any page id a user works with, whether it's about reading, writing or whatever.
239 * The point is that this will add the security that a user can NEVER touch parts outside his mounted pages in the page tree. This is otherwise possible if the raw page permissions allows for it. So this security check just makes it easier to make safe user configurations.
240 * If the user is admin OR if this feature is disabled (fx. by setting TYPO3_CONF_VARS['BE']['lockBeUserToDBmounts']=0) then it returns "1" right away
241 * Otherwise the function will return the uid of the webmount which was first found in the rootline of the input page $id
242 *
243 * @param integer Page ID to check
244 * @param string Content of "->getPagePermsClause(1)" (read-permissions). If not set, they will be internally calculated (but if you have the correct value right away you can save that database lookup!)
245 * @param boolean If set, then the function will exit with an error message.
246 * @return integer The page UID of a page in the rootline that matched a mount point
247 */
248 function isInWebMount($id,$readPerms='',$exitOnError=0) {
249 if (!$GLOBALS['TYPO3_CONF_VARS']['BE']['lockBeUserToDBmounts'] || $this->isAdmin()) return 1;
250 $id = intval($id);
251 if (!$readPerms) $readPerms = $this->getPagePermsClause(1);
252 if ($id>0) {
253 $wM = $this->returnWebmounts();
254 $rL = t3lib_BEfunc::BEgetRootLine($id,' AND '.$readPerms);
255
256 foreach($rL as $v) {
257 if ($v['uid'] && in_array($v['uid'],$wM)) {
258 return $v['uid'];
259 }
260 }
261 }
262 if ($exitOnError) {
263 t3lib_BEfunc::typo3PrintError ('Access Error','This page is not within your DB-mounts',0);
264 exit;
265 }
266 }
267
268 /**
269 * Checks access to a backend module with the $MCONF passed as first argument
270 *
271 * @param array $MCONF array of a backend module!
272 * @param boolean If set, an array will issue an error message and exit.
273 * @return boolean Will return true if $MCONF['access'] is not set at all, if the BE_USER is admin or if the module is enabled in the be_users/be_groups records of the user (specifically enabled). Will return false if the module name is not even found in $TBE_MODULES
274 */
275 function modAccess($conf,$exitOnError) {
276 if (!t3lib_BEfunc::isModuleSetInTBE_MODULES($conf['name'])) {
277 if ($exitOnError) {
278 t3lib_BEfunc::typo3PrintError ('Fatal Error','This module "'.$conf['name'].'" is not enabled in TBE_MODULES',0);
279 exit;
280 }
281 return FALSE;
282 }
283
284 // Workspaces check:
285 if ($conf['workspaces']) {
286 if (($this->workspace===0 && t3lib_div::inList($conf['workspaces'],'online')) ||
287 ($this->workspace===-1 && t3lib_div::inList($conf['workspaces'],'offline')) ||
288 ($this->workspace>0 && t3lib_div::inList($conf['workspaces'],'custom'))) {
289 // ok, go on...
290 } else {
291 if ($exitOnError) {
292 t3lib_BEfunc::typo3PrintError ('Workspace Error','This module "'.$conf['name'].'" is not available under the current workspace',0);
293 exit;
294 }
295 return FALSE;
296 }
297 }
298
299 // Returns true if conf[access] is not set at all or if the user is admin
300 if (!$conf['access'] || $this->isAdmin()) return TRUE;
301
302 // If $conf['access'] is set but not with 'admin' then we return true, if the module is found in the modList
303 if (!strstr($conf['access'],'admin') && $conf['name']) {
304 $acs = $this->check('modules',$conf['name']);
305 }
306 if (!$acs && $exitOnError) {
307 t3lib_BEfunc::typo3PrintError ('Access Error','You don\'t have access to this module.',0);
308 exit;
309 } else return $acs;
310 }
311
312 /**
313 * Returns a WHERE-clause for the pages-table where user permissions according to input argument, $perms, is validated.
314 * $perms is the 'mask' used to select. Fx. if $perms is 1 then you'll get all pages that a user can actually see!
315 * 2^0 = show (1)
316 * 2^1 = edit (2)
317 * 2^2 = delete (4)
318 * 2^3 = new (8)
319 * If the user is 'admin' " 1=1" is returned (no effect)
320 * If the user is not set at all (->user is not an array), then " 1=0" is returned (will cause no selection results at all)
321 * The 95% use of this function is "->getPagePermsClause(1)" which will return WHERE clauses for *selecting* pages in backend listings - in other words will this check read permissions.
322 *
323 * @param integer Permission mask to use, see function description
324 * @return string Part of where clause. Prefix " AND " to this.
325 */
326 function getPagePermsClause($perms) {
327 global $TYPO3_CONF_VARS;
328 if (is_array($this->user)) {
329 if ($this->isAdmin()) {
330 return ' 1=1';
331 }
332
333 $perms = intval($perms); // Make sure it's integer.
334 $str= ' ('.
335 '(pages.perms_everybody & '.$perms.' = '.$perms.')'. // Everybody
336 'OR(pages.perms_userid = '.$this->user['uid'].' AND pages.perms_user & '.$perms.' = '.$perms.')'; // User
337 if ($this->groupList){$str.='OR(pages.perms_groupid in ('.$this->groupList.') AND pages.perms_group & '.$perms.' = '.$perms.')';} // Group (if any is set)
338 $str.=')';
339
340 // ****************
341 // getPagePermsClause-HOOK
342 // ****************
343 if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_userauthgroup.php']['getPagePermsClause'])) {
344
345 foreach($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_userauthgroup.php']['getPagePermsClause'] as $_funcRef) {
346 $_params = array('currentClause' => $str, 'perms' => $perms);
347 $str = t3lib_div::callUserFunction($_funcRef, $_params, $this);
348 }
349 }
350
351 return $str;
352 } else {
353 return ' 1=0';
354 }
355 }
356
357 /**
358 * Returns a combined binary representation of the current users permissions for the page-record, $row.
359 * The perms for user, group and everybody is OR'ed together (provided that the page-owner is the user and for the groups that the user is a member of the group
360 * If the user is admin, 31 is returned (full permissions for all five flags)
361 *
362 * @param array Input page row with all perms_* fields available.
363 * @return integer Bitwise representation of the users permissions in relation to input page row, $row
364 */
365 function calcPerms($row) {
366 global $TYPO3_CONF_VARS;
367 if ($this->isAdmin()) {return 31;} // Return 31 for admin users.
368
369 $out=0;
370 if (isset($row['perms_userid']) && isset($row['perms_user']) && isset($row['perms_groupid']) && isset($row['perms_group']) && isset($row['perms_everybody']) && isset($this->groupList)) {
371 if ($this->user['uid']==$row['perms_userid']) {
372 $out|=$row['perms_user'];
373 }
374 if ($this->isMemberOfGroup($row['perms_groupid'])) {
375 $out|=$row['perms_group'];
376 }
377 $out|=$row['perms_everybody'];
378 }
379
380 // ****************
381 // CALCPERMS hook
382 // ****************
383 if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_userauthgroup.php']['calcPerms'])) {
384 foreach($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_userauthgroup.php']['calcPerms'] as $_funcRef) {
385 $_params = array(
386 'row' => $row,
387 'outputPermissions' => $out
388 );
389 $out = t3lib_div::callUserFunction($_funcRef, $_params, $this);
390 }
391 }
392
393 return $out;
394 }
395
396 /**
397 * Returns true if the RTE (Rich Text Editor) can be enabled for the user
398 * Strictly this is not permissions being checked but rather a series of settings like a loaded extension, browser/client type and a configuration option in ->uc[edit_RTE]
399 * The reasons for a FALSE return can be found in $this->RTE_errors
400 *
401 * @return boolean
402 */
403 function isRTE() {
404 global $CLIENT;
405
406 // Start:
407 $this->RTE_errors = array();
408 if (!$this->uc['edit_RTE'])
409 $this->RTE_errors[] = 'RTE is not enabled for user!';
410 if (!$GLOBALS['TYPO3_CONF_VARS']['BE']['RTEenabled'])
411 $this->RTE_errors[] = 'RTE is not enabled in $TYPO3_CONF_VARS["BE"]["RTEenabled"]';
412
413
414 // Acquire RTE object:
415 $RTE = &t3lib_BEfunc::RTEgetObj();
416 if (!is_object($RTE)) {
417 $this->RTE_errors = array_merge($this->RTE_errors, $RTE);
418 }
419
420 if (!count($this->RTE_errors)) {
421 return TRUE;
422 } else {
423 return FALSE;
424 }
425 }
426
427 /**
428 * Returns true if the $value is found in the list in a $this->groupData[] index pointed to by $type (array key).
429 * Can thus be users to check for modules, exclude-fields, select/modify permissions for tables etc.
430 * If user is admin true is also returned
431 * Please see the document Inside TYPO3 for examples.
432 *
433 * @param string The type value; "webmounts", "filemounts", "pagetypes_select", "tables_select", "tables_modify", "non_exclude_fields", "modules"
434 * @param string String to search for in the groupData-list
435 * @return boolean True if permission is granted (that is, the value was found in the groupData list - or the BE_USER is "admin")
436 */
437 function check($type,$value) {
438 if (isset($this->groupData[$type])) {
439 if ($this->isAdmin() || $this->inList($this->groupData[$type],$value)) {
440 return 1;
441 }
442 }
443 }
444
445 /**
446 * Checking the authMode of a select field with authMode set
447 *
448 * @param string Table name
449 * @param string Field name (must be configured in TCA and of type "select" with authMode set!)
450 * @param string Value to evaluation (single value, must not contain any of the chars ":,|")
451 * @param string Auth mode keyword (explicitAllow, explicitDeny, individual)
452 * @return boolean True or false whether access is granted or not.
453 */
454 function checkAuthMode($table,$field,$value,$authMode) {
455 global $TCA;
456
457 // Admin users can do anything:
458 if ($this->isAdmin()) return TRUE;
459
460 // Allow all blank values:
461 if (!strcmp($value,'')) return TRUE;
462
463 // Certain characters are not allowed in the value
464 if (ereg('[:|,]',$value)) {
465 return FALSE;
466 }
467
468 // Initialize:
469 $testValue = $table.':'.$field.':'.$value;
470 $out = TRUE;
471
472 // Checking value:
473 switch((string)$authMode) {
474 case 'explicitAllow':
475 if (!$this->inList($this->groupData['explicit_allowdeny'],$testValue.':ALLOW')) {
476 $out = FALSE;
477 }
478 break;
479 case 'explicitDeny':
480 if ($this->inList($this->groupData['explicit_allowdeny'],$testValue.':DENY')) {
481 $out = FALSE;
482 }
483 break;
484 case 'individual':
485 t3lib_div::loadTCA($table);
486 if (is_array($TCA[$table]) && is_array($TCA[$table]['columns'][$field])) {
487 $items = $TCA[$table]['columns'][$field]['config']['items'];
488 if (is_array($items)) {
489 foreach($items as $iCfg) {
490 if (!strcmp($iCfg[1],$value) && $iCfg[4]) {
491 switch((string)$iCfg[4]) {
492 case 'EXPL_ALLOW':
493 if (!$this->inList($this->groupData['explicit_allowdeny'],$testValue.':ALLOW')) {
494 $out = FALSE;
495 }
496 break;
497 case 'EXPL_DENY':
498 if ($this->inList($this->groupData['explicit_allowdeny'],$testValue.':DENY')) {
499 $out = FALSE;
500 }
501 break;
502 }
503 break;
504 }
505 }
506 }
507 }
508 break;
509 }
510
511 return $out;
512 }
513
514 /**
515 * Checking if a language value (-1, 0 and >0 for sys_language records) is allowed to be edited by the user.
516 *
517 * @param integer Language value to evaluate
518 * @return boolean Returns true if the language value is allowed, otherwise false.
519 */
520 function checkLanguageAccess($langValue) {
521 if (strcmp($this->groupData['allowed_languages'],'')) { // The users language list must be non-blank - otherwise all languages are allowed.
522 $langValue = intval($langValue);
523 if ($langValue != -1 && !$this->check('allowed_languages',$langValue)) { // Language must either be explicitly allowed OR the lang Value be "-1" (all languages)
524 return FALSE;
525 }
526 }
527 return TRUE;
528 }
529
530 /**
531 * Checking if a user has editing access to a record from a $TCA table.
532 * The checks does not take page permissions and other "environmental" things into account. It only deal with record internals; If any values in the record fields disallows it.
533 * For instance languages settings, authMode selector boxes are evaluated (and maybe more in the future).
534 * It will check for workspace dependent access.
535 * The function takes an ID (integer) or row (array) as second argument.
536 *
537 * @param string Table name
538 * @param mixed If integer, then this is the ID of the record. If Array this just represents fields in the record.
539 * @return boolean True if OK, otherwise false
540 */
541 function recordEditAccessInternals($table,$idOrRow) {
542 global $TCA;
543
544 if (isset($TCA[$table])) {
545 t3lib_div::loadTCA($table);
546
547 // Always return true for Admin users.
548 if ($this->isAdmin()) return TRUE;
549
550 // Fetching the record if the $idOrRow variable was not an array on input:
551 if (!is_array($idOrRow)) {
552 $idOrRow = t3lib_BEfunc::getRecord($table, $idOrRow);
553 if (!is_array($idOrRow)) {
554 $this->errorMsg = 'ERROR: Record could not be fetched.';
555 return FALSE;
556 }
557 }
558
559 // Checking languages:
560 if ($TCA[$table]['ctrl']['languageField']) {
561 if (isset($idOrRow[$TCA[$table]['ctrl']['languageField']])) { // Language field must be found in input row - otherwise it does not make sense.
562 if (!$this->checkLanguageAccess($idOrRow[$TCA[$table]['ctrl']['languageField']])) {
563 $this->errorMsg = 'ERROR: Language was not allowed.';
564 return FALSE;
565 }
566 }
567 }
568
569 // Checking authMode fields:
570 if (is_array($TCA[$table]['columns'])) {
571 foreach($TCA[$table]['columns'] as $fN => $fV) {
572 if (isset($idOrRow[$fN])) { //
573 if ($fV['config']['type']=='select' && $fV['config']['authMode'] && !strcmp($fV['config']['authMode_enforce'],'strict')) {
574 if (!$this->checkAuthMode($table,$fN,$idOrRow[$fN],$fV['config']['authMode'])) {
575 $this->errorMsg = 'ERROR: authMode "'.$fV['config']['authMode'].'" failed for field "'.$fN.'" with value "'.$idOrRow[$fN].'" evaluated';
576 return FALSE;
577 }
578 }
579 }
580 }
581 }
582
583 // Checking "editlock" feature
584 if ($TCA[$table]['ctrl']['editlock'] && $idOrRow[$TCA[$table]['ctrl']['editlock']]) {
585 $this->errorMsg = 'ERROR: Record was locked for editing. Only admin users can change this state.';
586 return FALSE;
587 }
588
589 // Checking record permissions
590 // THIS is where we can include a check for "perms_" fields for other records than pages...
591
592 // Finally, return true if all is well.
593 return TRUE;
594 }
595 }
596
597 /**
598 * Will check a type of permission against the compiled permission integer, $lCP, and in relation to table, $table
599 *
600 * @param integer $lCP could typically be the "compiled permissions" integer returned by ->calcPerms
601 * @param string $table is the tablename to check: If "pages" table then edit,new,delete and editcontent permissions can be checked. Other tables will be checked for "editcontent" only (and $type will be ignored)
602 * @param string For $table='pages' this can be 'edit' (2), 'new' (8 or 16), 'delete' (4), 'editcontent' (16). For all other tables this is ignored. (16 is used)
603 * @return boolean
604 * @access private
605 */
606 function isPSet($lCP,$table,$type='') {
607 if ($this->isAdmin()) return true;
608 if ($table=='pages') {
609 if ($type=='edit') return $lCP & 2;
610 if ($type=='new') return ($lCP & 8) || ($lCP & 16); // Create new page OR pagecontent
611 if ($type=='delete') return $lCP & 4;
612 if ($type=='editcontent') return $lCP & 16;
613 } else {
614 return $lCP & 16;
615 }
616 }
617
618 /**
619 * Returns true if the BE_USER is allowed to *create* shortcuts in the backend modules
620 *
621 * @return boolean
622 */
623 function mayMakeShortcut() {
624 return $this->getTSConfigVal('options.shortcutFrame') && !$this->getTSConfigVal('options.mayNotCreateEditShortcuts');
625 }
626
627 /**
628 * Checking if editing of an existing record is allowed in current workspace if that is offline.
629 * Rules for editing in offline mode:
630 * - record supports versioning and is an offline version from workspace and has the corrent stage
631 * - or record (any) is in a branch where there is a page which is a version from the workspace and where the stage is not preventing records
632 *
633 * @param string Table of record
634 * @param array Integer (record uid) or array where fields are at least: pid, t3ver_wsid, t3ver_stage (if versioningWS is set)
635 * @return string String error code, telling the failure state. FALSE=All ok
636 */
637 function workspaceCannotEditRecord($table,$recData) {
638
639 if ($this->workspace!==0) { // Only test offline spaces:
640
641 if (!is_array($recData)) {
642 $recData = t3lib_BEfunc::getRecord($table,$recData,'pid'.($GLOBALS['TCA'][$table]['ctrl']['versioningWS']?',t3ver_wsid,t3ver_stage':''));
643 }
644
645 if (is_array($recData)) {
646 if ((int)$recData['pid']===-1) { // We are testing a "version" (identified by a pid of -1): it can be edited provided that workspace matches and versioning is enabled for the table.
647 if (!$GLOBALS['TCA'][$table]['ctrl']['versioningWS']) { // No versioning, basic error, inconsistency even! Such records should not have a pid of -1!
648 return 'Versioning disabled for table';
649 } elseif ((int)$recData['t3ver_wsid']!==$this->workspace) { // So does workspace match?
650 return 'Workspace ID of record didn\'t match current workspace';
651 } else { // So what about the stage of the version, does that allow editing for this user?
652 return $this->workspaceCheckStageForCurrent($recData['t3ver_stage']) ? FALSE : 'Record stage "'.$recData['t3ver_stage'].'" and users access level did not allow for editing';
653 }
654 } else { // We are testing a "live" record:
655 if ($res = $this->workspaceAllowLiveRecordsInPID($recData['pid'], $table)) { // For "Live" records, check that PID for table allows editing
656 // Live records are OK in this branch, but what about the stage of branch point, if any:
657 return $res>0 ? FALSE : 'Stage for versioning root point and users access level did not allow for editing'; // OK
658 } else { // If not offline and not in versionized branch, output error:
659 return 'Online record was not in versionized branch!';
660 }
661 }
662 } else return 'No record';
663 } else {
664 return FALSE; // OK because workspace is 0
665 }
666 }
667
668 function workspaceCannotEditOfflineVersion($table,$recData) {
669 if ($GLOBALS['TCA'][$table]['ctrl']['versioningWS']) {
670
671 if (!is_array($recData)) {
672 $recData = t3lib_BEfunc::getRecord($table,$recData,'uid,pid,t3ver_wsid,t3ver_stage');
673 }
674 if (is_array($recData)) {
675 if ((int)$recData['pid']===-1) {
676 return $this->workspaceCannotEditRecord($table,$recData);
677 } else return 'Not an offline version';
678 } else return 'No record';
679 } else return 'Table does not support versioning.';
680 }
681
682 /**
683 * Check if "live" records from $table may be created or edited in this PID.
684 * If the answer is FALSE it means the only valid way to create or edit records in the PID is by versioning
685 * If the answer is 1 or 2 it means it is OK to create a record, if -1 it means that it is OK in terms of versioning because the element was within a versionized branch but NOT ok in terms of the state the root point had!
686 *
687 * @param integer PID value to check for.
688 * @param string Table name
689 * @return mixed Returns FALSE if a live record cannot be created and must be versionized in order to do so. 2 means a) Workspace is "Live" or workspace allows "live edit" of records from non-versionized tables (and the $table is not versionizable). 1 and -1 means the pid is inside a versionized branch where -1 means that the branch-point did NOT allow a new record according to its state.
690 */
691 function workspaceAllowLiveRecordsInPID($pid, $table) {
692
693 // Always for Live workspace AND if live-edit is enabled and tables are completely without versioning it is ok as well.
694 if ($this->workspace===0 || ($this->workspaceRec['live_edit'] && !$GLOBALS['TCA'][$table]['ctrl']['versioningWS'])) {
695 return 2; // OK to create for this table.
696 } elseif (t3lib_BEfunc::isPidInVersionizedBranch($pid, $table)) { // Check if records from $table can be created with this PID: Either if inside "branch" versioning type or a "versioning_followPages" table on a "page" versioning type.
697 // Now, check what the stage of that "page" or "branch" version type is:
698 $stage = t3lib_BEfunc::isPidInVersionizedBranch($pid, $table, TRUE);
699 return $this->workspaceCheckStageForCurrent($stage) ? 1 : -1;
700 } else {
701 return FALSE; // If the answer is FALSE it means the only valid way to create or edit records in the PID is by versioning
702 }
703 }
704
705 /**
706 * Evaluates if a record from $table can be created in $pid
707 *
708 * @param integer Page id. This value must be the _ORIG_uid if available: So when you have pages versionized as "page" or "element" you must supply the id of the page version in the workspace!
709 * @param string Table name
710 * @return boolean TRUE if OK.
711 */
712 function workspaceCreateNewRecord($pid, $table) {
713 if ($res = $this->workspaceAllowLiveRecordsInPID($pid,$table)) { // If LIVE records cannot be created in the current PID due to workspace restrictions, prepare creation of placeholder-record
714 if ($res<0) {
715 return FALSE; // Stage for versioning root point and users access level did not allow for editing
716 }
717 } elseif (!$GLOBALS['TCA'][$table]['ctrl']['versioningWS']) { // So, if no live records were allowed, we have to create a new version of this record:
718 return FALSE;
719 }
720 return TRUE;
721 }
722
723 /**
724 * Evaluates if auto creation of a version of a record is allowed.
725 *
726 * @param string Table of the record
727 * @param integer UID of record
728 * @param integer PID of record
729 * @return boolean TRUE if ok.
730 */
731 function workspaceAllowAutoCreation($table,$id,$recpid) {
732 // Auto-creation of version: In offline workspace, test if versioning is enabled and look for workspace version of input record. If there is no versionized record found we will create one and save to that.
733 if ($this->workspace!==0 // Only in draft workspaces
734 && !$this->workspaceRec['disable_autocreate'] // Auto-creation must not be disabled.
735 && $GLOBALS['TCA'][$table]['ctrl']['versioningWS'] // Table must be versionizable
736 && $recpid >= 0 // The PID of the record must NOT be -1 or less (would indicate that it already was a version!)
737 && !t3lib_BEfunc::getWorkspaceVersionOfRecord($this->workspace, $table, $id, 'uid') // There must be no existing version of this record in workspace.
738 && !t3lib_BEfunc::isPidInVersionizedBranch($recpid, $table)) { // PID must NOT be in a versionized branch either
739 return TRUE;
740 }
741 }
742
743 /**
744 * Checks if an element stage allows access for the user in the current workspace
745 * In workspaces 0 (Live) and -1 (Default draft) access is always granted for any stage.
746 * Admins are always allowed.
747 *
748 * @param integer Stage id from an element: -1,0 = editing, 1 = reviewer, >1 = owner
749 * @return boolean TRUE if user is allowed access
750 */
751 function workspaceCheckStageForCurrent($stage) {
752 if ($this->isAdmin()) return TRUE;
753
754 if ($this->workspace>0) {
755 $stat = $this->checkWorkspaceCurrent();
756 if (($stage<=0 && $stat['_ACCESS']==='member') ||
757 ($stage<=1 && $stat['_ACCESS']==='reviewer') ||
758 ($stat['_ACCESS']==='owner')) {
759 return TRUE; // OK for these criteria
760 }
761 } else return TRUE; // Always OK for live and draft workspaces.
762 }
763
764 /**
765 * Returns TRUE if the user has access to publish content from the workspace ID given.
766 * Admin-users are always granted access to do this
767 * If the workspace ID is 0 (live) all users have access also
768 * If -1 (draft workspace) TRUE is returned if the user has access to the Live workspace
769 * For custom workspaces it depends on whether the user is owner OR like with draft workspace if the user has access to Live workspace.
770 *
771 * @param integer Workspace UID; -1,0,1+
772 * @return boolean Returns TRUE if the user has access to publish content from the workspace ID given.
773 */
774 function workspacePublishAccess($wsid) {
775 if ($this->isAdmin()) return TRUE;
776
777 $wsAccess = $this->checkWorkspace($wsid);
778 if ($wsAccess) {
779 switch($wsAccess['uid']) {
780 case 0: // Live workspace
781 return TRUE; // If access to Live workspace, no problem.
782 break;
783 case -1: // Default draft workspace
784 return $this->checkWorkspace(0) ? TRUE : FALSE; // If access to Live workspace, no problem.
785 break;
786 default: // Custom workspace
787 return $wsAccess['_ACCESS'] === 'owner' || $this->checkWorkspace(0); // Either be an adminuser OR have access to online workspace which is OK as well.
788 break;
789 }
790 } else return FALSE; // If no access to workspace, of course you cannot publish!
791 }
792
793 /**
794 * Workspace swap-mode access?
795 *
796 * @return boolean Returns TRUE if records can be swapped in the current workspace, otherwise false
797 */
798 function workspaceSwapAccess() {
799 if ($this->workspace>0 && (int)$this->workspaceRec['swap_modes']===2) {
800 return FALSE;
801 } else return TRUE;
802 }
803
804 /**
805 * Workspace Versioning type access?
806 *
807 * @param integer Versioning type to evaluation: -1, 0, >1
808 * @return boolean TRUE if OK
809 */
810 function workspaceVersioningTypeAccess($type) {
811 if ($this->workspace>0 && !$this->isAdmin()) {
812 $stat = $this->checkWorkspaceCurrent();
813 if ($stat['_ACCESS']!=='owner') {
814
815 $type = t3lib_div::intInRange($type,-1);
816 switch((int)$type) {
817 case -1:
818 return $this->workspaceRec['vtypes']&1 ? FALSE : TRUE;
819 break;
820 case 0:
821 return $this->workspaceRec['vtypes']&2 ? FALSE : TRUE;
822 break;
823 default:
824 return $this->workspaceRec['vtypes']&4 ? FALSE : TRUE;
825 break;
826 }
827 } else return TRUE;
828 } else return TRUE;
829 }
830
831 /**
832 * Finding "closest" versioning type, used for creation of new records.
833 *
834 * @param integer Versioning type to evaluation: -1, 0, >1
835 * @return integer Returning versioning type
836 */
837 function workspaceVersioningTypeGetClosest($type) {
838 if ($this->workspace>0) {
839 $type = t3lib_div::intInRange($type,-1);
840 switch((int)$type) {
841 case -1:
842 return -1;
843 break;
844 case 0:
845 return $this->workspaceVersioningTypeAccess($type) ? $type : -1;
846 break;
847 default:
848 return $this->workspaceVersioningTypeAccess($type) ? $type : ($this->workspaceVersioningTypeAccess(0) ? 0 : -1);
849 break;
850 }
851 } else return $type;
852 }
853
854
855
856
857
858
859
860
861
862
863 /*************************************
864 *
865 * Miscellaneous functions
866 *
867 *************************************/
868
869 /**
870 * Returns the value/properties of a TS-object as given by $objectString, eg. 'options.dontMountAdminMounts'
871 * Nice (general!) function for returning a part of a TypoScript array!
872 *
873 * @param string Pointer to an "object" in the TypoScript array, fx. 'options.dontMountAdminMounts'
874 * @param array Optional TSconfig array: If array, then this is used and not $this->userTS. If not array, $this->userTS is used.
875 * @return array An array with two keys, "value" and "properties" where "value" is a string with the value of the objectsting and "properties" is an array with the properties of the objectstring.
876 * @params array An array with the TypoScript where the $objectString is located. If this argument is not an array, then internal ->userTS (User TSconfig for the current BE_USER) will be used instead.
877 */
878 function getTSConfig($objectString,$config='') {
879 if (!is_array($config)) {
880 $config=$this->userTS; // Getting Root-ts if not sent
881 }
882 $TSConf=array();
883 $parts = explode('.',$objectString,2);
884 $key = $parts[0];
885 if (trim($key)) {
886 if (count($parts)>1 && trim($parts[1])) {
887 // Go on, get the next level
888 if (is_array($config[$key.'.'])) $TSConf = $this->getTSConfig($parts[1],$config[$key.'.']);
889 } else {
890 $TSConf['value']=$config[$key];
891 $TSConf['properties']=$config[$key.'.'];
892 }
893 }
894 return $TSConf;
895 }
896
897 /**
898 * Returns the "value" of the $objectString from the BE_USERS "User TSconfig" array
899 *
900 * @param string Object string, eg. "somestring.someproperty.somesubproperty"
901 * @return string The value for that object string (object path)
902 * @see getTSConfig()
903 */
904 function getTSConfigVal($objectString) {
905 $TSConf = $this->getTSConfig($objectString);
906 return $TSConf['value'];
907 }
908
909 /**
910 * Returns the "properties" of the $objectString from the BE_USERS "User TSconfig" array
911 *
912 * @param string Object string, eg. "somestring.someproperty.somesubproperty"
913 * @return array The properties for that object string (object path) - if any
914 * @see getTSConfig()
915 */
916 function getTSConfigProp($objectString) {
917 $TSConf = $this->getTSConfig($objectString);
918 return $TSConf['properties'];
919 }
920
921 /**
922 * Returns true if $item is in $in_list
923 *
924 * @param string Comma list with items, no spaces between items!
925 * @param string The string to find in the list of items
926 * @return string Boolean
927 */
928 function inList($in_list,$item) {
929 return strstr(','.$in_list.',', ','.$item.',');
930 }
931
932 /**
933 * Returns an array with the webmounts.
934 * If no webmounts, and empty array is returned.
935 * NOTICE: Deleted pages WILL NOT be filtered out! So if a mounted page has been deleted it is STILL coming out as a webmount. This is not checked due to performance.
936 *
937 * @return array
938 */
939 function returnWebmounts() {
940 return (string)($this->groupData['webmounts'])!='' ? explode(',',$this->groupData['webmounts']) : Array();
941 }
942
943 /**
944 * Returns an array with the filemounts for the user. Each filemount is represented with an array of a "name", "path" and "type".
945 * If no filemounts an empty array is returned.
946 *
947 * @return array
948 */
949 function returnFilemounts() {
950 return $this->groupData['filemounts'];
951 }
952
953
954
955
956
957
958
959
960
961
962
963
964 /*************************************
965 *
966 * Authentication methods
967 *
968 *************************************/
969
970
971 /**
972 * Initializes a lot of stuff like the access-lists, database-mountpoints and filemountpoints
973 * This method is called by ->backendCheckLogin() (from extending class t3lib_beuserauth) if the backend user login has verified OK.
974 * Generally this is required initialization of a backend user.
975 *
976 * @return void
977 * @access private
978 * @see t3lib_TSparser
979 */
980 function fetchGroupData() {
981 if ($this->user['uid']) {
982
983 // Get lists for the be_user record and set them as default/primary values.
984 $this->dataLists['modList'] = $this->user['userMods']; // Enabled Backend Modules
985 $this->dataLists['allowed_languages'] = $this->user['allowed_languages']; // Add Allowed Languages
986 $this->dataLists['workspace_perms'] = $this->user['workspace_perms']; // Set user value for workspace permissions.
987 $this->dataLists['webmount_list'] = $this->user['db_mountpoints']; // Database mountpoints
988 $this->dataLists['filemount_list'] = $this->user['file_mountpoints']; // File mountpoints
989
990 // Setting default User TSconfig:
991 $this->TSdataArray[]=$this->addTScomment('From $GLOBALS["TYPO3_CONF_VARS"]["BE"]["defaultUserTSconfig"]:').
992 $GLOBALS['TYPO3_CONF_VARS']['BE']['defaultUserTSconfig'];
993
994 // Default TSconfig for admin-users
995 if ($this->isAdmin()) {
996 $this->TSdataArray[]=$this->addTScomment('"admin" user presets:').'
997 admPanel.enable.all = 1
998 options.shortcutFrame = 1
999 ';
1000 if (t3lib_extMgm::isLoaded('sys_note')) {
1001 $this->TSdataArray[]='
1002 // Setting defaults for sys_note author / email...
1003 TCAdefaults.sys_note.author = '.$this->user['realName'].'
1004 TCAdefaults.sys_note.email = '.$this->user['email'].'
1005 ';
1006 }
1007 }
1008
1009 // FILE MOUNTS:
1010 // Admin users has the base fileadmin dir mounted
1011 if ($this->isAdmin() && $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir']) {
1012 $this->addFileMount($GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'], '', PATH_site.$GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'], 0, '');
1013 }
1014
1015 // If userHomePath is set, we attempt to mount it
1016 if ($GLOBALS['TYPO3_CONF_VARS']['BE']['userHomePath']) {
1017 // First try and mount with [uid]_[username]
1018 $didMount=$this->addFileMount($this->user['username'], '',$GLOBALS['TYPO3_CONF_VARS']['BE']['userHomePath'].$this->user['uid'].'_'.$this->user['username'].$GLOBALS['TYPO3_CONF_VARS']['BE']['userUploadDir'], 0, 'user');
1019 if (!$didMount) {
1020 // If that failed, try and mount with only [uid]
1021 $this->addFileMount($this->user['username'], '', $GLOBALS['TYPO3_CONF_VARS']['BE']['userHomePath'].$this->user['uid'].$GLOBALS['TYPO3_CONF_VARS']['BE']['userUploadDir'], 0, 'user');
1022 }
1023 }
1024
1025 // BE_GROUPS:
1026 // Get the groups...
1027 # $grList = t3lib_BEfunc::getSQLselectableList($this->user[$this->usergroup_column],$this->usergroup_table,$this->usergroup_table);
1028 $grList = $GLOBALS['TYPO3_DB']->cleanIntList($this->user[$this->usergroup_column]); // 240203: Since the group-field never contains any references to groups with a prepended table name we think it's safe to just intExplode and re-implode - which should be much faster than the other function call.
1029 if ($grList) {
1030 // Fetch groups will add a lot of information to the internal arrays: modules, accesslists, TSconfig etc. Refer to fetchGroups() function.
1031 $this->fetchGroups($grList);
1032 }
1033
1034 // Add the TSconfig for this specific user:
1035 $this->TSdataArray[] = $this->addTScomment('USER TSconfig field').$this->user['TSconfig'];
1036 // Check include lines.
1037 $this->TSdataArray = t3lib_TSparser::checkIncludeLines_array($this->TSdataArray);
1038
1039 // Parsing the user TSconfig (or getting from cache)
1040 $this->userTS_text = implode(chr(10).'[GLOBAL]'.chr(10),$this->TSdataArray); // Imploding with "[global]" will make sure that non-ended confinements with braces are ignored.
1041 $hash = md5('userTS:'.$this->userTS_text);
1042 $cachedContent = t3lib_BEfunc::getHash($hash,0);
1043 if (isset($cachedContent) && !$this->userTS_dontGetCached) {
1044 $this->userTS = unserialize($cachedContent);
1045 } else {
1046 $parseObj = t3lib_div::makeInstance('t3lib_TSparser');
1047 $parseObj->parse($this->userTS_text);
1048 $this->userTS = $parseObj->setup;
1049 t3lib_BEfunc::storeHash($hash,serialize($this->userTS),'BE_USER_TSconfig');
1050 // Update UC:
1051 $this->userTSUpdated=1;
1052 }
1053
1054 // Processing webmounts
1055 if ($this->isAdmin() && !$this->getTSConfigVal('options.dontMountAdminMounts')) { // Admin's always have the root mounted
1056 $this->dataLists['webmount_list']='0,'.$this->dataLists['webmount_list'];
1057 }
1058
1059 // Processing filemounts
1060 $this->dataLists['filemount_list'] = t3lib_div::uniqueList($this->dataLists['filemount_list']);
1061 if ($this->dataLists['filemount_list']) {
1062 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_filemounts', 'deleted=0 AND hidden=0 AND pid=0 AND uid IN ('.$this->dataLists['filemount_list'].')');
1063 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
1064 $this->addFileMount($row['title'], $row['path'], $row['path'], $row['base']?1:0, '');
1065 }
1066 }
1067
1068 // The lists are cleaned for duplicates
1069 $this->groupData['webmounts'] = t3lib_div::uniqueList($this->dataLists['webmount_list']);
1070 $this->groupData['pagetypes_select'] = t3lib_div::uniqueList($this->dataLists['pagetypes_select']);
1071 $this->groupData['tables_select'] = t3lib_div::uniqueList($this->dataLists['tables_modify'].','.$this->dataLists['tables_select']);
1072 $this->groupData['tables_modify'] = t3lib_div::uniqueList($this->dataLists['tables_modify']);
1073 $this->groupData['non_exclude_fields'] = t3lib_div::uniqueList($this->dataLists['non_exclude_fields']);
1074 $this->groupData['explicit_allowdeny'] = t3lib_div::uniqueList($this->dataLists['explicit_allowdeny']);
1075 $this->groupData['allowed_languages'] = t3lib_div::uniqueList($this->dataLists['allowed_languages']);
1076 $this->groupData['custom_options'] = t3lib_div::uniqueList($this->dataLists['custom_options']);
1077 $this->groupData['modules'] = t3lib_div::uniqueList($this->dataLists['modList']);
1078 $this->groupData['workspace_perms'] = $this->dataLists['workspace_perms'];
1079
1080 // populating the $this->userGroupsUID -array with the groups in the order in which they were LAST included.!!
1081 $this->userGroupsUID = array_reverse(array_unique(array_reverse($this->includeGroupArray)));
1082
1083 // Finally this is the list of group_uid's in the order they are parsed (including subgroups!) and without duplicates (duplicates are presented with their last entrance in the list, which thus reflects the order of the TypoScript in TSconfig)
1084 $this->groupList = implode(',',$this->userGroupsUID);
1085 $this->setCachedList($this->groupList);
1086
1087 // Checking read access to webmounts:
1088 if (trim($this->groupData['webmounts'])!=='') {
1089 $webmounts = explode(',',$this->groupData['webmounts']); // Explode mounts
1090 $MProws = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid', 'pages', 'deleted=0 AND uid IN ('.$this->groupData['webmounts'].') AND '.$this->getPagePermsClause(1),'','','','uid'); // Selecting all webmounts with permission clause for reading
1091 foreach($webmounts as $idx => $mountPointUid) {
1092 if ($mountPointUid>0 && !isset($MProws[$mountPointUid])) { // If the mount ID is NOT found among selected pages, unset it:
1093 unset($webmounts[$idx]);
1094 }
1095 }
1096 $this->groupData['webmounts'] = implode(',',$webmounts); // Implode mounts in the end.
1097 }
1098
1099 // Setting up workspace situation (after webmounts are processed!):
1100 $this->workspaceInit();
1101 }
1102 }
1103
1104 /**
1105 * Fetches the group records, subgroups and fills internal arrays.
1106 * Function is called recursively to fetch subgroups
1107 *
1108 * @param string Commalist of be_groups uid numbers
1109 * @param string List of already processed be_groups-uids so the function will not fall into a eternal recursion.
1110 * @return void
1111 * @access private
1112 */
1113 function fetchGroups($grList,$idList='') {
1114
1115 // Fetching records of the groups in $grList (which are not blocked by lockedToDomain either):
1116 $lockToDomain_SQL = ' AND (lockToDomain=\'\' OR lockToDomain=\''.t3lib_div::getIndpEnv('HTTP_HOST').'\')';
1117 $whereSQL = 'deleted=0 AND hidden=0 AND pid=0 AND uid IN ('.$grList.')'.$lockToDomain_SQL;
1118
1119 // Hook for manipulation of the WHERE sql sentence which controls which BE-groups are included
1120 if (is_array ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauthgroup.php']['fetchGroupQuery'])) {
1121 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauthgroup.php']['fetchGroupQuery'] as $classRef) {
1122 $hookObj = &t3lib_div::getUserObj($classRef);
1123 if(method_exists($hookObj,'fetchGroupQuery_processQuery')){
1124 $whereSQL = $hookObj->fetchGroupQuery_processQuery($this, $grList, $idList, $whereSQL);
1125 }
1126 }
1127 }
1128
1129 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $this->usergroup_table, $whereSQL);
1130
1131 // The userGroups array is filled
1132 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
1133 $this->userGroups[$row['uid']] = $row;
1134 }
1135
1136 // Traversing records in the correct order
1137 $include_staticArr = t3lib_div::intExplode(',',$grList);
1138 reset($include_staticArr);
1139 while(list(,$uid)=each($include_staticArr)) { // traversing list
1140
1141 // Get row:
1142 $row=$this->userGroups[$uid];
1143 if (is_array($row) && !t3lib_div::inList($idList,$uid)) { // Must be an array and $uid should not be in the idList, because then it is somewhere previously in the grouplist
1144
1145 // Include sub groups
1146 if (trim($row['subgroup'])) {
1147 $theList = implode(',',t3lib_div::intExplode(',',$row['subgroup'])); // Make integer list
1148 $this->fetchGroups($theList, $idList.','.$uid); // Call recursively, pass along list of already processed groups so they are not recursed again.
1149 }
1150 // Add the group uid, current list, TSconfig to the internal arrays.
1151 $this->includeGroupArray[]=$uid;
1152 $this->includeHierarchy[]=$idList;
1153 $this->TSdataArray[] = $this->addTScomment('Group "'.$row['title'].'" ['.$row['uid'].'] TSconfig field:').$row['TSconfig'];
1154
1155 // Mount group database-mounts
1156 if (($this->user['options']&1) == 1) { $this->dataLists['webmount_list'].= ','.$row['db_mountpoints']; }
1157
1158 // Mount group file-mounts
1159 if (($this->user['options']&2) == 2) { $this->dataLists['filemount_list'].= ','.$row['file_mountpoints']; }
1160
1161 // Mount group home-dirs
1162 if (($this->user['options']&2) == 2) {
1163 // If groupHomePath is set, we attempt to mount it
1164 if ($GLOBALS['TYPO3_CONF_VARS']['BE']['groupHomePath']) {
1165 $this->addFileMount($row['title'], '', $GLOBALS['TYPO3_CONF_VARS']['BE']['groupHomePath'].$row['uid'], 0, 'group');
1166 }
1167 }
1168
1169 // The lists are made: groupMods, tables_select, tables_modify, pagetypes_select, non_exclude_fields, explicit_allowdeny, allowed_languages, custom_options
1170 if ($row['inc_access_lists']==1) {
1171 $this->dataLists['modList'].= ','.$row['groupMods'];
1172 $this->dataLists['tables_select'].= ','.$row['tables_select'];
1173 $this->dataLists['tables_modify'].= ','.$row['tables_modify'];
1174 $this->dataLists['pagetypes_select'].= ','.$row['pagetypes_select'];
1175 $this->dataLists['non_exclude_fields'].= ','.$row['non_exclude_fields'];
1176 $this->dataLists['explicit_allowdeny'].= ','.$row['explicit_allowdeny'];
1177 $this->dataLists['allowed_languages'].= ','.$row['allowed_languages'];
1178 $this->dataLists['custom_options'].= ','.$row['custom_options'];
1179 }
1180
1181 // Setting workspace permissions:
1182 $this->dataLists['workspace_perms'] |= $row['workspace_perms'];
1183
1184 // If this function is processing the users OWN group-list (not subgroups) AND if the ->firstMainGroup is not set, then the ->firstMainGroup will be set.
1185 if (!strcmp($idList,'') && !$this->firstMainGroup) {
1186 $this->firstMainGroup=$uid;
1187 }
1188 }
1189 }
1190 }
1191
1192 /**
1193 * Updates the field be_users.usergroup_cached_list if the groupList of the user has changed/is different from the current list.
1194 * The field "usergroup_cached_list" contains the list of groups which the user is a member of. After authentication (where these functions are called...) one can depend on this list being a representation of the exact groups/subgroups which the BE_USER has membership with.
1195 *
1196 * @param string The newly compiled group-list which must be compared with the current list in the user record and possibly stored if a difference is detected.
1197 * @return void
1198 * @access private
1199 */
1200 function setCachedList($cList) {
1201 if ((string)$cList != (string)$this->user['usergroup_cached_list']) {
1202 $GLOBALS['TYPO3_DB']->exec_UPDATEquery('be_users', 'uid='.intval($this->user['uid']), array('usergroup_cached_list' => $cList));
1203 }
1204 }
1205
1206 /**
1207 * Adds a filemount to the users array of filemounts, $this->groupData['filemounts'][hash_key] = Array ('name'=>$name, 'path'=>$path, 'type'=>$type);
1208 * Is a part of the authentication proces of the user.
1209 * A final requirement for a path being mounted is that a) it MUST return true on is_dir(), b) must contain either PATH_site+'fileadminDir' OR 'lockRootPath' - if lockRootPath is set - as first part of string!
1210 * Paths in the mounted information will always be absolute and have a trailing slash.
1211 *
1212 * @param string $title will be the (root)name of the filemount in the folder tree
1213 * @param string $altTitle will be the (root)name of the filemount IF $title is not true (blank or zero)
1214 * @param string $path is the path which should be mounted. Will accept backslash in paths on windows servers (will substituted with forward slash). The path should be 1) relative to TYPO3_CONF_VARS[BE][fileadminDir] if $webspace is set, otherwise absolute.
1215 * @param boolean If $webspace is set, the $path is relative to 'fileadminDir' in TYPO3_CONF_VARS, otherwise $path is absolute. 'fileadminDir' must be set to allow mounting of relative paths.
1216 * @param string Type of filemount; Can be blank (regular) or "user" / "group" (for user and group filemounts presumably). Probably sets the icon first and foremost.
1217 * @return boolean Returns "1" if the requested filemount was mounted, otherwise no return value.
1218 * @access private
1219 */
1220 function addFileMount($title, $altTitle, $path, $webspace, $type) {
1221 // Return false if fileadminDir is not set and we try to mount a relative path
1222 if ($webspace && !$GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir']) return false;
1223
1224 // Trimming and pre-processing
1225 $path=trim($path);
1226 if ($this->OS=='WIN') { // with WINDOWS convert backslash to slash!!
1227 $path=str_replace('\\','/',$path);
1228 }
1229 // If the path is true and validates as a valid path string:
1230 if ($path && t3lib_div::validPathStr($path)) {
1231 // these lines remove all slashes and dots before and after the path
1232 $path=ereg_replace('^[\/\. ]*','',$path);
1233 $path=trim(ereg_replace('[\/\. ]*$','',$path));
1234
1235
1236 if ($path) { // there must be some chars in the path
1237 $fdir=PATH_site.$GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir']; // fileadmin dir, absolute
1238 if ($webspace) {
1239 $path=$fdir.$path; // PATH_site + fileadmin dir is prepended
1240 } else {
1241 if ($this->OS!='WIN') { // with WINDOWS no prepending!!
1242 $path='/'.$path; // root-level is the start...
1243 }
1244 }
1245 $path.='/';
1246
1247 // We now have a path with slash after and slash before (if unix)
1248 if (@is_dir($path) &&
1249 (($GLOBALS['TYPO3_CONF_VARS']['BE']['lockRootPath'] && t3lib_div::isFirstPartOfStr($path,$GLOBALS['TYPO3_CONF_VARS']['BE']['lockRootPath'])) || t3lib_div::isFirstPartOfStr($path,$fdir))) {
1250 // Alternative title?
1251 $name = $title ? $title : $altTitle;
1252 // Adds the filemount. The same filemount with same name, type and path cannot be set up twice because of the hash string used as key.
1253 $this->groupData['filemounts'][md5($name.'|'.$path.'|'.$type)] = Array('name'=>$name, 'path'=>$path, 'type'=>$type);
1254 // Return true - went well, success!
1255 return 1;
1256 }
1257 }
1258 }
1259 }
1260
1261 /**
1262 * Creates a TypoScript comment with the string text inside.
1263 *
1264 * @param string The text to wrap in comment prefixes and delimiters.
1265 * @return string TypoScript comment with the string text inside.
1266 */
1267 function addTScomment($str) {
1268 $delimiter = '# ***********************************************';
1269
1270 $out = $delimiter.chr(10);
1271 $lines = t3lib_div::trimExplode(chr(10),$str);
1272 foreach($lines as $v) {
1273 $out.= '# '.$v.chr(10);
1274 }
1275 $out.= $delimiter.chr(10);
1276 return $out;
1277 }
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290 /************************************
1291 *
1292 * Workspaces
1293 *
1294 ************************************/
1295
1296 /**
1297 * Initializing workspace.
1298 * Called from within this function, see fetchGroupData()
1299 *
1300 * @return void
1301 * @see fetchGroupData()
1302 */
1303 function workspaceInit() {
1304
1305 // Initializing workspace by evaluating and setting the workspace, possibly updating it in the user record!
1306 $this->setWorkspace($this->user['workspace_id']);
1307
1308 // Setting up the db mount points of the (custom) workspace, if any:
1309 if ($this->workspace>0 && $this->workspaceRec['db_mountpoints']!=='') {
1310
1311 // Initialize:
1312 $newMounts = array();
1313 $readPerms = '1=1'; // Notice: We cannot call $this->getPagePermsClause(1); as usual because the group-list is not available at this point. But bypassing is fine because all we want here is check if the workspace mounts are inside the current webmounts rootline. The actual permission checking on page level is done elsewhere as usual anyway before the page tree is rendered.
1314
1315 // Traverse mount points of the
1316 $mountPoints = t3lib_div::intExplode(',',$this->workspaceRec['db_mountpoints']);
1317 foreach($mountPoints as $mpId) {
1318 if ($this->isInWebMount($mpId,$readPerms)) {
1319 $newMounts[] = $mpId;
1320 }
1321 }
1322
1323 // Re-insert webmounts:
1324 $this->groupData['webmounts'] = implode(',',array_unique($newMounts));
1325 }
1326
1327 // Setting up the file mount points of the (custom) workspace, if any:
1328 if ($this->workspace!==0) $this->groupData['filemounts'] = array();
1329 if ($this->workspace>0 && $this->workspaceRec['file_mountpoints']!=='') {
1330
1331 // Processing filemounts
1332 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_filemounts', 'deleted=0 AND hidden=0 AND pid=0 AND uid IN ('.$GLOBALS['TYPO3_DB']->cleanIntList($this->workspaceRec['file_mountpoints']).')');
1333 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
1334 $this->addFileMount($row['title'], $row['path'], $row['path'], $row['base']?1:0, '');
1335 }
1336 }
1337 }
1338
1339 /**
1340 * Checking if a workspace is allowed for backend user
1341 *
1342 * @param mixed If integer, workspace record is looked up, if array it is seen as a Workspace record with at least uid, title, members and adminusers columns. Can be faked for workspaces uid 0 and -1 (online and offline)
1343 * @param string List of fields to select. Default fields are: uid,title,adminusers,members,reviewers
1344 * @return array TRUE if access. Output will also show how access was granted. Admin users will have a true output regardless of input.
1345 */
1346 function checkWorkspace($wsRec,$fields='uid,title,adminusers,members,reviewers') {
1347
1348 // If not array, look up workspace record:
1349 if (!is_array($wsRec)) {
1350 switch((string)$wsRec) {
1351 case '0':
1352 case '-1':
1353 $wsRec = array('uid' => $wsRec);
1354 break;
1355 default:
1356 list($wsRec) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
1357 $fields,
1358 'sys_workspace',
1359 'pid=0 AND uid='.intval($wsRec).
1360 t3lib_BEfunc::deleteClause('sys_workspace'),
1361 '',
1362 'title'
1363 );
1364 break;
1365 }
1366 }
1367
1368 // If wsRec is set to an array, evaluate it:
1369 if (is_array($wsRec)) {
1370 if ($this->isAdmin()) {
1371 return array_merge($wsRec,array('_ACCESS' => 'admin'));
1372 } else {
1373
1374 switch((string)$wsRec['uid']) {
1375 case '0':
1376 return ($this->groupData['workspace_perms']&1) ? array_merge($wsRec,array('_ACCESS' => 'online')) : FALSE;
1377 break;
1378 case '-1':
1379 return ($this->groupData['workspace_perms']&2) ? array_merge($wsRec,array('_ACCESS' => 'offline')) : FALSE;
1380 break;
1381 default:
1382 // Checking if the guy is admin:
1383 if (t3lib_div::inList($wsRec['adminusers'],$this->user['uid'])) {
1384 return array_merge($wsRec, array('_ACCESS' => 'owner'));
1385 }
1386 // Checking if he is reviewer user:
1387 if (t3lib_div::inList($wsRec['reviewers'],'be_users_'.$this->user['uid'])) {
1388 return array_merge($wsRec, array('_ACCESS' => 'reviewer'));
1389 }
1390 // Checking if he is reviewer through a user group of his:
1391 foreach($this->userGroupsUID as $groupUid) {
1392 if (t3lib_div::inList($wsRec['reviewers'],'be_groups_'.$groupUid)) {
1393 return array_merge($wsRec, array('_ACCESS' => 'reviewer'));
1394 }
1395 }
1396 // Checking if he is member as user:
1397 if (t3lib_div::inList($wsRec['members'],'be_users_'.$this->user['uid'])) {
1398 return array_merge($wsRec, array('_ACCESS' => 'member'));
1399 }
1400 // Checking if he is member through a user group of his:
1401 foreach($this->userGroupsUID as $groupUid) {
1402 if (t3lib_div::inList($wsRec['members'],'be_groups_'.$groupUid)) {
1403 return array_merge($wsRec, array('_ACCESS' => 'member'));
1404 }
1405 }
1406 break;
1407 }
1408 }
1409 }
1410
1411 return FALSE;
1412 }
1413
1414 /**
1415 * Uses checkWorkspace() to check if current workspace is available for user. This function caches the result and so can be called many times with no performance loss.
1416 *
1417 * @return array See checkWorkspace()
1418 * @see checkWorkspace()
1419 */
1420 function checkWorkspaceCurrent() {
1421 if (!isset($this->checkWorkspaceCurrent_cache)) {
1422 $this->checkWorkspaceCurrent_cache = $this->checkWorkspace($this->workspace);
1423 }
1424 return $this->checkWorkspaceCurrent_cache;
1425 }
1426
1427 /**
1428 * Setting workspace ID
1429 *
1430 * @param integer ID of workspace to set for backend user. If not valid the default workspace for BE user is found and set.
1431 * @return void
1432 */
1433 function setWorkspace($workspaceId) {
1434
1435 // Check workspace validity and if not found, revert to default workspace.
1436 if ($this->workspaceRec = $this->checkWorkspace($workspaceId,'*')) {
1437 // Set workspace ID internally
1438 $this->workspace = (int)$workspaceId;
1439 } else {
1440 $this->workspace = (int)$this->getDefaultWorkspace();
1441 $this->workspaceRec = $this->checkWorkspace($this->workspace,'*');
1442 }
1443
1444 // Unset access cache:
1445 unset($this->checkWorkspaceCurrent_cache);
1446
1447 // If ID is different from the stored one, change it:
1448 if (strcmp($this->workspace, $this->user['workspace_id'])) {
1449 $this->user['workspace_id'] = $this->workspace;
1450 $GLOBALS['TYPO3_DB']->exec_UPDATEquery('be_users','uid='.intval($this->user['uid']),array('workspace_id' => $this->user['workspace_id']));
1451 $this->simplelog('User changed workspace to "'.$this->workspace.'"');
1452 }
1453 }
1454
1455 /**
1456 * Setting workspace preview state for user:
1457 *
1458 * @param boolean State
1459 * @return void
1460 */
1461 function setWorkspacePreview($previewState) {
1462 $this->user['workspace_preview'] = $previewState;
1463 $GLOBALS['TYPO3_DB']->exec_UPDATEquery('be_users','uid='.intval($this->user['uid']),array('workspace_preview' => $this->user['workspace_preview']));
1464 }
1465
1466 /**
1467 * Return default workspace ID for user
1468 *
1469 * @return integer Default workspace id. If no workspace is available it will be "-99"
1470 */
1471 function getDefaultWorkspace() {
1472
1473 if ($this->checkWorkspace(0)) { // Check online
1474 return 0;
1475 } elseif ($this->checkWorkspace(-1)) { // Check offline
1476 return -1;
1477 } else { // Traverse custom workspaces:
1478 $workspaces = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid,title,adminusers,members,reviewers','sys_workspace','pid=0'.t3lib_BEfunc::deleteClause('sys_workspace'),'','title');
1479 foreach($workspaces as $rec) {
1480 if ($this->checkWorkspace($rec)) {
1481 return $rec['uid'];
1482 }
1483 }
1484 }
1485 return -99;
1486 }
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498 /************************************
1499 *
1500 * Logging
1501 *
1502 ************************************/
1503
1504 /**
1505 * Writes an entry in the logfile/table
1506 * Documentation in "TYPO3 Core API"
1507 *
1508 * @param integer Denotes which module that has submitted the entry. See "TYPO3 Core API". Use "4" for extensions.
1509 * @param integer Denotes which specific operation that wrote the entry. Use "0" when no sub-categorizing applies
1510 * @param integer Flag. 0 = message, 1 = error (user problem), 2 = System Error (which should not happen), 3 = security notice (admin)
1511 * @param integer The message number. Specific for each $type and $action. This will make it possible to translate errormessages to other languages
1512 * @param string Default text that follows the message (in english!). Possibly translated by identification through type/action/details_nr
1513 * @param array Data that follows the log. Might be used to carry special information. If an array the first 5 entries (0-4) will be sprintf'ed with the details-text
1514 * @param string Table name. Special field used by tce_main.php.
1515 * @param integer Record UID. Special field used by tce_main.php.
1516 * @param integer Record PID. Special field used by tce_main.php. OBSOLETE
1517 * @param integer The page_uid (pid) where the event occurred. Used to select log-content for specific pages.
1518 * @param string Special field used by tce_main.php. NEWid string of newly created records.
1519 * @param integer Alternative Backend User ID (used for logging login actions where this is not yet known).
1520 * @return integer Log entry ID.
1521 */
1522 function writelog($type,$action,$error,$details_nr,$details,$data,$tablename='',$recuid='',$recpid='',$event_pid=-1,$NEWid='',$userId=0) {
1523
1524 $fields_values = Array (
1525 'userid' => $userId ? $userId : intval($this->user['uid']),
1526 'type' => intval($type),
1527 'action' => intval($action),
1528 'error' => intval($error),
1529 'details_nr' => intval($details_nr),
1530 'details' => $details,
1531 'log_data' => serialize($data),
1532 'tablename' => $tablename,
1533 'recuid' => intval($recuid),
1534 # 'recpid' => intval($recpid),
1535 'IP' => t3lib_div::getIndpEnv('REMOTE_ADDR'),
1536 'tstamp' => $GLOBALS['EXEC_TIME'],
1537 'event_pid' => intval($event_pid),
1538 'NEWid' => $NEWid,
1539 'workspace' => $this->workspace
1540 );
1541
1542 $GLOBALS['TYPO3_DB']->exec_INSERTquery('sys_log', $fields_values);
1543 return $GLOBALS['TYPO3_DB']->sql_insert_id();
1544 }
1545
1546 /**
1547 * Simple logging function
1548 *
1549 * @param string Log message
1550 * @param string Option extension key / module name
1551 * @param integer Error level. 0 = message, 1 = error (user problem), 2 = System Error (which should not happen), 3 = security notice (admin)
1552 * @return integer Log entry UID
1553 */
1554 function simplelog($message, $extKey='', $error=0) {
1555 return $this->writelog(
1556 4,
1557 0,
1558 $error,
1559 0,
1560 ($extKey?'['.$extKey.'] ':'').$message,
1561 array()
1562 );
1563 }
1564
1565 /**
1566 * Sends a warning to $email if there has been a certain amount of failed logins during a period.
1567 * If a login fails, this function is called. It will look up the sys_log to see if there has been more than $max failed logins the last $secondsBack seconds (default 3600). If so, an email with a warning is sent to $email.
1568 *
1569 * @param string Email address
1570 * @param integer Number of sections back in time to check. This is a kind of limit for how many failures an hour for instance.
1571 * @param integer Max allowed failures before a warning mail is sent
1572 * @return void
1573 * @access private
1574 */
1575 function checkLogFailures($email, $secondsBack=3600, $max=3) {
1576
1577 if ($email) {
1578
1579 // get last flag set in the log for sending
1580 $theTimeBack = time()-$secondsBack;
1581 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
1582 'tstamp',
1583 'sys_log',
1584 'type=255 AND action=4 AND tstamp>'.intval($theTimeBack),
1585 '',
1586 'tstamp DESC',
1587 '1'
1588 );
1589 if ($testRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
1590 $theTimeBack = $testRow['tstamp'];
1591 }
1592
1593 // Check for more than $max number of error failures with the last period.
1594 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
1595 '*',
1596 'sys_log',
1597 'type=255 AND action=3 AND error!=0 AND tstamp>'.intval($theTimeBack),
1598 '',
1599 'tstamp'
1600 );
1601 if ($GLOBALS['TYPO3_DB']->sql_num_rows($res) > $max) {
1602 // OK, so there were more than the max allowed number of login failures - so we will send an email then.
1603 $subject = 'TYPO3 Login Failure Warning (at '.$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'].')';
1604 $email_body = '
1605 There has been numerous attempts ('.$GLOBALS['TYPO3_DB']->sql_num_rows($res).') to login at the TYPO3
1606 site "'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'].'" ('.t3lib_div::getIndpEnv('HTTP_HOST').').
1607
1608 This is a dump of the failures:
1609
1610 ';
1611 while($testRows = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
1612 $theData = unserialize($testRows['log_data']);
1613 $email_body.=date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'].' H:i',$testRows['tstamp']).': '.@sprintf($testRows['details'],''.$theData[0],''.$theData[1],''.$theData[2]);
1614 $email_body.=chr(10);
1615 }
1616 mail( $email,
1617 $subject,
1618 $email_body,
1619 'From: TYPO3 Login WARNING<>'
1620 );
1621 $this->writelog(255,4,0,3,'Failure warning (%s failures within %s seconds) sent by email to %s',Array($GLOBALS['TYPO3_DB']->sql_num_rows($res),$secondsBack,$email)); // Logout written to log
1622 }
1623 }
1624 }
1625 }
1626
1627
1628
1629 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_userauthgroup.php']) {
1630 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_userauthgroup.php']);
1631 }
1632 ?>