3 * Site Admin user properties editing page
5 * Copyright 1999-2001 (c) VA Linux Systems
7 * This file is part of GForge.
9 * GForge is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * GForge 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
20 * along with GForge; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 require_once('../env.inc.php');
25 require_once $gfwww.'include/pre.php';
26 require_once $gfcommon.'include/account.php';
27 require_once $gfwww.'admin/admin_utils.php';
29 session_require(array('group'=>'1','admin_flags'=>'A'));
30 $unix_status2str = array(
31 'N'=>_('No Unix account (N)'),
33 'S'=>_('Suspended (S)'),
37 $user_id = getIntFromRequest('user_id');
38 $u =& user_get_object($user_id);
39 if (!$u || !is_object($u)) {
40 exit_error('Error','Could Not Get User');
41 } elseif ($u->isError()) {
42 exit_error('Error',$u->getErrorMessage());
45 if (getStringFromRequest('delete_user') != '' && getStringFromRequest('confirm_delete') == '1') {
47 if (!$u->delete(true)) {
49 _('Could Not Complete Operation'),
53 $feedback = _('Deleted (D)').'<br />';
56 } elseif (getStringFromRequest('action') == "update_user" && getStringFromRequest('delete_user') == '') {
57 $email = getStringFromRequest('email');
58 $shell = getStringFromRequest('shell');
59 $status = getStringFromRequest('status');
62 if (!$u->setEmail($email)
63 || ($sys_use_shell && !$u->setShell($shell))
64 || !$u->setStatus($status)) {
66 _('Could Not Complete Operation'),
71 if ($u->getUnixStatus() != 'N') {
72 $u->setUnixStatus($status);
74 if (count($u->getGroups())>0 && $u->isActive()) {
75 $u->setUnixStatus('A');
77 // make sure that user doesn't have LDAP entry
78 $u->setUnixStatus('N');
83 $feedback = $u->getErrorMessage();
85 $feedback = _('Updated').'<br />';
91 site_admin_header(array('title'=>_('Site Admin: User Info')));
94 <h3><?php echo _('Account Information'); ?><sup>1</sup></h3>
96 <form method="post" action="<?php echo getStringFromServer('PHP_SELF'); ?>">
97 <input type="hidden" name="action" value="update_user" />
98 <input type="hidden" name="user_id" value="<?php print $user_id; ?>" />
103 <?php echo _('User ID:'); ?>
106 <?php echo $u->getID(); ?>
112 <?php echo _('User name:'); ?>
115 <?php echo $u->getUnixName(); ?>
121 <?php echo _('Real name'); ?>
124 <?php echo $u->getRealName(); ?>
130 <?php echo _('Web account status'); ?>
134 if ($u->getStatus() == 'D') {
135 $status_letter = array('P','A','S','D');
136 $status_text = array(_('Pending (P)'),
141 $status_letter = array('P','A','S');
142 $status_text = array(_('Pending (P)'),
147 <?php echo html_build_select_box_from_arrays(
148 $status_letter, $status_text,'status', $u->getStatus(), false);
154 global $sys_use_shell;
156 if ($sys_use_shell) {
160 <?php echo _('Unix Account Status'); ?><sup>2</sup>:
163 <?php echo $unix_status2str[$u->getUnixStatus()]; ?>
169 <?php echo _('Unix Shell:'); ?>
172 <select name="shell">
173 <?php account_shellselects($u->getShell()); ?>
178 } // end of sys_use_shell conditionnal
183 <?php echo _('Email:'); ?>
186 <input type="text" name="email" value="<?php echo $u->getEmail(); ?>" size="25" maxlength="255" />
192 <?php echo _('Current confirm hash:'); ?>
195 <?php echo $u->getConfirmHash(); ?>
198 <?php if ($u->getStatus() != 'D') { ?>
200 <td colspan="2"><input type="checkbox" name="confirm_delete" value="1" /><?php echo _('I want to delete this user'); ?>
201 <input type="submit" name="delete_user" value="<?php echo _('Delete'); ?>" /><br />
206 <input type="submit" name="submit" value="<?php echo _('Update'); ?>" />
208 <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 global $sys_use_shell;
214 if ($sys_use_shell) {
217 <sup>2</sup><?php echo _('Unix status updated mirroring web status, unless it has value \'No unix account (N)\''); ?>
220 } //end of sys_use_shell condition
227 <h3><?php echo _('Groups Membership'); ?></h3>
231 Iterate and show groups this user is in
233 $res_cat = db_query("
234 SELECT groups.unix_group_name, groups.group_name AS group_name,
235 groups.group_id AS group_id,
236 user_group.admin_flags AS admin_flags
237 FROM groups,user_group
238 WHERE user_group.user_id=$user_id
239 AND groups.group_id=user_group.group_id
244 $title[]=_('Unix name');
245 $title[]=_('Operations');
246 echo $GLOBALS['HTML']->listTableTop($title);
249 while ($row_cat = db_fetch_array($res_cat)) {
251 $row_cat['group_name'] = htmlspecialchars($row_cat['group_name']);
253 <tr '.$GLOBALS['HTML']->boxGetAltRowStyle($i++).'>
254 <td>'.$row_cat['group_name'].'</td>
255 <td>'.$row_cat['unix_group_name'].'</td>
256 <td width="40%">'.util_make_link ('/project/admin/?group_id='.$row_cat['group_id'],_('[Project Admin]')).'</td>
262 echo $GLOBALS['HTML']->listTableBottom();
265 site_admin_footer(array());
269 // c-file-style: "bsd"