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
29 var $_is_external = 0;
31 function _FusionForgePassUser($UserName = '', $prefs = false)
33 if ($prefs) $this->_prefs = $prefs;
34 if (!isset($this->_prefs->_method))
35 _PassUser::_PassUser($UserName);
36 if ($UserName) $this->_userid = $UserName;
37 $this->_authmethod = 'FusionForge';
39 // Is this double check really needed?
40 // It is not expensive so we keep it for now.
41 if ($this->userExists())
44 return $GLOBALS['ForbiddenUser'];
51 // Mapping (PhpWiki vs FusionForge) performed is:
52 // ANON for non logged or non member
53 // USER for member of the project.
54 // ADMIN for member having admin rights
55 if (session_loggedin()) {
57 // Get project object (if error => ANON)
58 $project = group_get_object($group_id);
60 if (!$project || !is_object($project)) {
61 $this->_level = WIKIAUTH_ANON;
63 } elseif ($project->isError()) {
64 $this->_level = WIKIAUTH_ANON;
69 $user = session_get_user();
70 $perm =& $project->getPermission();
71 if (!$perm || !is_object($perm)) {
72 $this->_level = WIKIAUTH_ANON;
74 } elseif (!$perm->isError()) {
75 $member = $perm->isMember();
79 $this->_userid = $user->getRealName();
80 $this->_is_external = method_exists($user, 'getIsExternal') && $user->getIsExternal();
81 if ($perm->isAdmin()) {
82 $this->_level = WIKIAUTH_ADMIN;
84 $this->_level = WIKIAUTH_USER;
89 $this->_level = WIKIAUTH_ANON;
93 function checkPass($submitted_password)
95 return $this->userExists()
96 ? ($this->isAdmin() ? WIKIAUTH_ADMIN : WIKIAUTH_USER)
100 function mayChangePass()
110 // c-hanging-comment-ender-p: nil
111 // indent-tabs-mode: nil