3 * Site Admin user properties editing page
5 * Copyright 1999-2001 (c) VA Linux Systems
6 * Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
8 * This file is part of FusionForge.
10 * FusionForge is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * FusionForge is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with FusionForge; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 require_once('../env.inc.php');
26 require_once $gfcommon.'include/pre.php';
27 require_once $gfcommon.'include/account.php';
28 require_once $gfwww.'admin/admin_utils.php';
30 session_require_global_perm ('forge_admin');
32 $unix_status2str = array(
33 'N'=>_('No Unix account (N)'),
35 'S'=>_('Suspended (S)'),
39 $user_id = getIntFromRequest('user_id');
40 $u =& user_get_object($user_id);
41 if (!$u || !is_object($u)) {
42 exit_error(_('Could Not Get User'),'admin');
43 } elseif ($u->isError()) {
44 exit_error($u->getErrorMessage(),'admin');
47 if (getStringFromRequest('delete_user') != '' && getStringFromRequest('confirm_delete') == '1') {
49 if (!$u->delete(true)) {
50 exit_error( _('Could Not Complete Operation: ').$u->getErrorMessage(),'admin');
52 $feedback = _('Deleted (D)').'<br />';
55 } elseif (getStringFromRequest('action') == "update_user" && getStringFromRequest('delete_user') == '') {
56 $email = getStringFromRequest('email');
57 $shell = getStringFromRequest('shell');
58 $status = getStringFromRequest('status');
61 if (!$u->setEmail($email)
62 || (forge_get_config('use_shell') && !$u->setShell($shell))
63 || !$u->setStatus($status)) {
64 exit_error( _('Could Not Complete Operation: ').$u->getErrorMessage(),'admin');
67 if ($u->getUnixStatus() != 'N') {
68 $u->setUnixStatus($status);
70 if (count($u->getGroups())>0 && $u->isActive()) {
71 $u->setUnixStatus('A');
73 // make sure that user doesn't have LDAP entry
74 $u->setUnixStatus('N');
79 $error_msg = $u->getErrorMessage();
81 $feedback = _('Updated');
86 $title = _('Site Admin: User Info');
87 site_admin_header(array('title'=>$title));
90 <h2><?php echo _('Account Information'); ?><sup>1</sup></h2>
92 <form method="post" action="<?php echo getStringFromServer('PHP_SELF'); ?>">
93 <input type="hidden" name="action" value="update_user" />
94 <input type="hidden" name="user_id" value="<?php print $user_id; ?>" />
99 <?php echo _('User Id:'); ?>
102 <?php echo $u->getID(); ?>
108 <?php echo _('User name:'); ?>
111 <?php echo $u->getUnixName(); ?>
117 <?php echo _('Real name'); ?>
120 <?php echo $u->getRealName(); ?>
126 <?php echo _('Web account status'); ?>
130 if ($u->getStatus() == 'D') {
131 $status_letter = array('P','A','S','D');
132 $status_text = array(_('Pending (P)'),
137 $status_letter = array('P','A','S');
138 $status_text = array(_('Pending (P)'),
143 <?php echo html_build_select_box_from_arrays(
144 $status_letter, $status_text,'status', $u->getStatus(), false);
152 if (forge_get_config('use_shell')) {
156 <?php echo _('Unix Account Status'); ?><sup>2</sup>:
159 <?php echo $unix_status2str[$u->getUnixStatus()]; ?>
165 <?php echo _('Unix Shell:'); ?>
168 <select name="shell">
169 <?php account_shellselects($u->getShell()); ?>
174 } // end of sys_use_shell conditionnal
179 <?php echo _('Email:'); ?>
182 <input type="text" name="email" value="<?php echo $u->getEmail(); ?>" size="25" maxlength="255" />
188 <?php echo _('Current confirm hash:'); ?>
191 <?php echo $u->getConfirmHash(); ?>
194 <?php if ($u->getStatus() != 'D') { ?>
196 <td colspan="2"><input type="checkbox" name="confirm_delete" value="1" /><?php echo _('I want to delete this user'); ?>
197 <input type="submit" name="delete_user" value="<?php echo _('Delete'); ?>" /><br />
202 <input type="submit" name="submit" value="<?php echo _('Update'); ?>" />
204 <sup>1</sup><?php echo _('This pages allows to change only direct properties of user object. To edit properties pertinent to user within specific group, visit admin page of that group (below).'); ?>
210 if (forge_get_config('use_shell')) {
213 <sup>2</sup><?php echo _('Unix status updated mirroring web status, unless it has value \'No unix account (N)\''); ?>
216 } //end of sys_use_shell condition
223 <h2><?php echo _('Projects Membership'); ?></h2>
227 Iterate and show projects this user is in
229 $projects = $u->getGroups() ;
233 $title[]=_('Unix name');
234 $title[]=_('Operations');
235 echo $GLOBALS['HTML']->listTableTop($title);
238 foreach ($projects as $p) {
240 <tr '.$GLOBALS['HTML']->boxGetAltRowStyle($i++).'>
241 <td>'.util_unconvert_htmlspecialchars(htmlspecialchars($p->getPublicName())).'</td>
242 <td>'.$p->getUnixName().'</td>
243 <td width="40%">'.util_make_link ('/project/admin/?group_id='.$p->getID(),_('[Project Admin]')).'</td>
249 echo $GLOBALS['HTML']->listTableBottom();
252 site_admin_footer(array());
256 // c-file-style: "bsd"