]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/WikiUser/LdapUpper.php
Reformat code
[SourceForge/phpwiki.git] / lib / WikiUser / LdapUpper.php
1 <?php
2
3 /*
4  * Copyright (C) 2007,2009 Reini Urban
5  *
6  * This file is part of PhpWiki.
7  *
8  * PhpWiki is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * PhpWiki is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with PhpWiki; if not, write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21  */
22 include_once 'lib/WikiUser/LDAP.php';
23
24 /**
25  * Overrides for LDAP (Windows domain) usernames:
26  *   Search lowercase, but convert it then to uppercase to match the WINDOWS name.
27  * Define the vars LDAP_AUTH_HOST, LDAP_BASE_DN, LDAP_SEARCH_FILTER in config/config.ini
28  * Preferences are handled in _PassUser
29  */
30 class _LdapUpperPassUser
31     extends _LDAPPassUser
32 {
33
34     function checkPass($submitted_password)
35     {
36         return parent::checkPass($submitted_password);
37     }
38
39     function UserName()
40     {
41         if (!empty($this->_userid)) {
42             $this->_userid = trim(strtoupper($this->_userid));
43             if (!empty($this->_HomePagehandle) and is_object($this->_HomePagehandle))
44                 $this->_HomePagehandle->_pagename = $this->_userid;
45             return strtoupper($this->_userid);
46         }
47     }
48
49     function userExists()
50     {
51         // lowercase check and uppercase visibility
52         $this->_userid = trim(strtoupper($this->_userid));
53         return parent::userExists();
54     }
55 }
56
57 // Local Variables:
58 // mode: php
59 // tab-width: 8
60 // c-basic-offset: 4
61 // c-hanging-comment-ender-p: nil
62 // indent-tabs-mode: nil
63 // End: