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. FusionForge is free software;
9 * you can redistribute it and/or modify it under the terms of the
10 * GNU General Public License as published by the Free Software
11 * Foundation; either version 2 of the Licence, or (at your option)
14 * FusionForge is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License along
20 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 require_once('../env.inc.php');
25 require_once $gfcommon.'include/pre.php';
26 require_once $gfcommon.'include/account.php';
27 require_once $gfwww.'admin/admin_utils.php';
29 session_require_global_perm ('forge_admin');
31 $unix_status2str = array(
32 'N'=>_('No Unix account (N)'),
34 'S'=>_('Suspended (S)'),
38 $user_id = getIntFromRequest('user_id');
39 $u =& user_get_object($user_id);
40 if (!$u || !is_object($u)) {
41 exit_error(_('Could Not Get User'),'admin');
42 } elseif ($u->isError()) {
43 exit_error($u->getErrorMessage(),'admin');
46 if (getStringFromRequest('delete_user') != '' && getStringFromRequest('confirm_delete') == '1') {
48 if (!$u->delete(true)) {
49 exit_error( _('Could Not Complete Operation: ').$u->getErrorMessage(),'admin');
51 $feedback = _('Deleted (D)').'<br />';
54 } elseif (getStringFromRequest('action') == "update_user" && getStringFromRequest('delete_user') == '') {
55 $email = getStringFromRequest('email');
56 $shell = getStringFromRequest('shell');
57 $status = getStringFromRequest('status');
60 if (!$u->setEmail($email)
61 || (forge_get_config('use_shell') && !$u->setShell($shell))
62 || !$u->setStatus($status)) {
63 exit_error( _('Could Not Complete Operation: ').$u->getErrorMessage(),'admin');
66 if ($u->getUnixStatus() != 'N') {
67 $u->setUnixStatus($status);
69 if (count($u->getGroups())>0 && $u->isActive()) {
70 $u->setUnixStatus('A');
72 // make sure that user doesn't have LDAP entry
73 $u->setUnixStatus('N');
78 $error_msg = $u->getErrorMessage();
80 $feedback = _('Updated');
85 $title = _('Site Admin: User Info');
86 site_admin_header(array('title'=>$title));
89 <h2><?php echo _('Account Information'); ?><sup>1</sup></h2>
91 <form method="post" action="<?php echo getStringFromServer('PHP_SELF'); ?>">
92 <input type="hidden" name="action" value="update_user" />
93 <input type="hidden" name="user_id" value="<?php print $user_id; ?>" />
98 <?php echo _('User Id:'); ?>
101 <?php echo $u->getID(); ?>
107 <?php echo _('User name:'); ?>
110 <?php echo $u->getUnixName(); ?>
116 <?php echo _('Real name'); ?>
119 <?php echo $u->getRealName(); ?>
125 <?php echo _('Web account status'); ?>
129 if ($u->getStatus() == 'D') {
130 $status_letter = array('P','A','S','D');
131 $status_text = array(_('Pending (P)'),
135 } else if ($u->getStatus() == 'P') {
136 $status_letter = array('P','A','S');
137 $status_text = array(_('Pending (P)'),
141 $status_letter = array('A','S');
142 $status_text = array(_('Active (A)'),
145 echo html_build_select_box_from_arrays(
146 $status_letter, $status_text,'status', $u->getStatus(), false);
154 if (forge_get_config('use_shell')) {
158 <?php echo _('Unix Account Status'); ?><sup>2</sup>:
161 <?php echo $unix_status2str[$u->getUnixStatus()]; ?>
167 <?php echo _('Unix Shell:'); ?>
170 <select name="shell">
171 <?php account_shellselects($u->getShell()); ?>
176 } // end of sys_use_shell conditionnal
181 <?php echo _('Email:'); ?>
184 <input type="text" name="email" value="<?php echo $u->getEmail(); ?>" size="25" maxlength="255" />
190 <?php echo _('Current confirm hash:'); ?>
193 <?php echo $u->getConfirmHash(); ?>
196 <?php if ($u->getStatus() != 'D') { ?>
198 <td colspan="2"><input type="checkbox" name="confirm_delete" value="1" /><?php echo _('I want to delete this user'); ?>
199 <input type="submit" name="delete_user" value="<?php echo _('Delete'); ?>" /><br />
204 <input type="submit" name="submit" value="<?php echo _('Update'); ?>" />
206 <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).'); ?>
212 if (forge_get_config('use_shell')) {
215 <sup>2</sup><?php echo _('Unix status updated mirroring web status, unless it has value \'No unix account (N)\''); ?>
218 } //end of sys_use_shell condition
225 <h2><?php echo _('Projects Membership'); ?></h2>
229 Iterate and show projects this user is in
231 $projects = $u->getGroups() ;
235 $title[]=_('Unix name');
236 $title[]=_('Operations');
239 foreach ($projects as $p) {
241 echo $GLOBALS['HTML']->listTableTop($title);
244 <tr '.$GLOBALS['HTML']->boxGetAltRowStyle($i++).'>
245 <td>'.util_unconvert_htmlspecialchars(htmlspecialchars($p->getPublicName())).'</td>
246 <td>'.$p->getUnixName().'</td>
247 <td width="40%">'.util_make_link ('/project/admin/?group_id='.$p->getID(),_('[Project Admin]')).'</td>
254 echo $GLOBALS['HTML']->listTableBottom();
256 echo '<p>'._('This user is not a member of any project.').'</p>';
260 site_admin_footer(array());
264 // c-file-style: "bsd"