introduce system services used for authentication for now
[Packages/TYPO3.CMS.git] / typo3 / sysext / sv / class.tx_sv_authbase.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2004 Kasper Skaarhoj (kasper@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 *
17 * This script is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * This copyright notice MUST APPEAR in all copies of the script!
23 ***************************************************************/
24 /**
25 * Service base class for 'User authentication'.
26 *
27 * @author René Fritz <r.fritz@colorcube.de>
28 */
29
30 require_once(PATH_t3lib.'class.t3lib_svbase.php');
31
32 class tx_sv_authbase extends t3lib_svbase {
33
34 var $pObj; // Parent object
35
36 var $mode; // Subtype of the service which is used to call the service.
37
38 var $login=array(); // Submitted login form data
39 var $info=array(); // Various data
40
41 var $db_user=array(); // User db table definition
42 var $db_groups=array(); // Usergroups db table definition
43
44 var $writeAttemptLog = 0; // If the writelog() functions is called if a login-attempt has be tried without success
45
46 /**
47 * init service
48 *
49 * @param string Subtype of the service which is used to call the service.
50 * @param array Submitted login form data
51 * @param array Information array. Holds submitted form data etc.
52 * @param object Parent object
53 * @return void
54 */
55 function initAuth($mode, $loginData, $info, &$pObj) {
56
57 $this->pObj = &$pObj;
58
59 $this->mode = $mode;
60 $this->login = $loginData;
61 $this->info = $info;
62
63 $this->db_user = $this->getServiceOption('db_user', $info['db_user'], FALSE);
64 $this->db_groups = $this->getServiceOption('db_groups', $info['db_groups'], FALSE);
65
66 $this->writeAttemptLog = $this->pObj->writeAttemptLog;
67 $this->writeDevLog = $this->pObj->writeDevLog;
68 }
69
70 /**
71 * Writes to log database table in pObj
72 *
73 * @param integer $type: denotes which module that has submitted the entry. This is the current list: 1=tce_db; 2=tce_file; 3=system (eg. sys_history save); 4=modules; 254=Personal settings changed; 255=login / out action: 1=login, 2=logout, 3=failed login (+ errorcode 3), 4=failure_warning_email sent
74 * @param integer $action: denotes which specific operation that wrote the entry (eg. 'delete', 'upload', 'update' and so on...). Specific for each $type. Also used to trigger update of the interface. (see the log-module for the meaning of each number !!)
75 * @param integer $error: flag. 0 = message, 1 = error (user problem), 2 = System Error (which should not happen), 3 = security notice (admin)
76 * @param integer $details_nr: The message number. Specific for each $type and $action. in the future this will make it possible to translate errormessages to other languages
77 * @param string $details: Default text that follows the message
78 * @param array $data: 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 the details-text...
79 * @param string $tablename: Special field used by tce_main.php. These ($tablename, $recuid, $recpid) holds the reference to the record which the log-entry is about. (Was used in attic status.php to update the interface.)
80 * @param integer $recuid: Special field used by tce_main.php. These ($tablename, $recuid, $recpid) holds the reference to the record which the log-entry is about. (Was used in attic status.php to update the interface.)
81 * @param integer $recpid: Special field used by tce_main.php. These ($tablename, $recuid, $recpid) holds the reference to the record which the log-entry is about. (Was used in attic status.php to update the interface.)
82 * @return void
83 * @see t3lib_userauthgroup::writelog()
84 */
85 function writelog($type,$action,$error,$details_nr,$details,$data,$tablename='',$recuid='',$recpid='') {
86 if($this->pObj->writeAttemptLog) {
87 $this->pObj->writelog($type,$action,$error,$details_nr,$details,$data,$tablename,$recuid,$recpid);
88 }
89 }
90
91 }
92
93
94 ?>