4 * Copyright (C) 2006 Alain Peyrat
6 * This file is part of PhpWiki.
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.
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.
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.
23 /** Call the FusionForge functions to get the username
26 class _FusionForgePassUser extends _PassUser {
28 var $_is_external = 0;
30 function _FusionForgePassUser($UserName='',$prefs=false) {
31 if ($prefs) $this->_prefs = $prefs;
32 if (!isset($this->_prefs->_method))
33 _PassUser::_PassUser($UserName);
34 if ($UserName) $this->_userid = $UserName;
35 $this->_authmethod = 'FusionForge';
37 // Is this double check really needed?
38 // It is not expensive so we keep it for now.
39 if ($this->userExists())
42 return $GLOBALS['ForbiddenUser'];
45 function userExists() {
48 // Mapping (PhpWiki vs FusionForge) performed is:
49 // ANON for non logged or non member
50 // USER for member of the project.
51 // ADMIN for member having admin rights
52 if (session_loggedin()) {
54 // Get project object (if error => ANON)
55 $project = group_get_object($group_id);
57 if (!$project || !is_object($project)) {
58 $this->_level = WIKIAUTH_ANON;
60 } elseif ($project->isError()) {
61 $this->_level = WIKIAUTH_ANON;
66 $user = session_get_user();
67 $perm =& $project->getPermission($user);
68 if (!$perm || !is_object($perm)) {
69 $this->_level = WIKIAUTH_ANON;
71 } elseif (!$perm->isError()) {
72 $member = $perm->isMember();
76 $this->_userid = $user->getRealName();
77 $this->_is_external = method_exists($user, 'getIsExternal') && $user->getIsExternal();
78 if ($perm->isAdmin()) {
79 $this->_level = WIKIAUTH_ADMIN;
81 $this->_level = WIKIAUTH_USER;
86 $this->_level = WIKIAUTH_ANON;
90 function checkPass($submitted_password) {
91 return $this->userExists()
92 ? ($this->isAdmin() ? WIKIAUTH_ADMIN : WIKIAUTH_USER)
96 function mayChangePass() {
105 // c-hanging-comment-ender-p: nil
106 // indent-tabs-mode: nil