Projet

Général

Profil

Paste
Statistiques
| Branche: | Révision:

ryxeo-glpi-git / htdocs / front / user.form.php @ 1c14bcc4

Historique | Voir | Annoter | Télécharger (7,66 ko)

1
<?php
2
/*
3
 * @version $Id: user.form.php 7763 2009-01-06 18:44:50Z moyo $
4
 -------------------------------------------------------------------------
5
 GLPI - Gestionnaire Libre de Parc Informatique
6
 Copyright (C) 2003-2009 by the INDEPNET Development Team.
7

8
 http://indepnet.net/   http://glpi-project.org
9
 -------------------------------------------------------------------------
10

11
 LICENSE
12

13
 This file is part of GLPI.
14

15
 GLPI is free software; you can redistribute it and/or modify
16
 it under the terms of the GNU General Public License as published by
17
 the Free Software Foundation; either version 2 of the License, or
18
 (at your option) any later version.
19

20
 GLPI is distributed in the hope that it will be useful,
21
 but WITHOUT ANY WARRANTY; without even the implied warranty of
22
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
 GNU General Public License for more details.
24

25
 You should have received a copy of the GNU General Public License
26
 along with GLPI; if not, write to the Free Software
27
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
28
 --------------------------------------------------------------------------
29
 */
30

    
31
// ----------------------------------------------------------------------
32
// Original Author of file:
33
// Purpose of file:
34
// ----------------------------------------------------------------------
35

    
36

    
37

    
38
$NEEDED_ITEMS=array("user","profile","group","setup","tracking","computer","printer","networking","peripheral","monitor","software","enterprise","phone", "reservation","ldap","entity","rulesengine","rule.right");
39

    
40
define('GLPI_ROOT', '..');
41
include (GLPI_ROOT . "/inc/includes.php");
42

    
43
if(empty($_GET["ID"])) $_GET["ID"] = "";
44

    
45
if (!isset($_GET["start"])) {
46
        $_GET["start"]=0;
47
}
48

    
49
if (!isset($_GET["sort"])) $_GET["sort"]="";
50
if (!isset($_GET["order"])) $_GET["order"]="";
51

    
52

    
53

    
54
$user=new User();
55
if (empty($_GET["ID"])&&isset($_GET["name"])){
56

    
57
        $user->getFromDBbyName($_GET["name"]);
58
        glpi_header($CFG_GLPI["root_doc"]."/front/user.form.php?ID=".$user->fields['ID']);
59
}
60

    
61
if(empty($_GET["name"])) $_GET["name"] = "";
62

    
63
if (isset($_POST["add"])) {
64
        checkRight("user","w");
65

    
66
        // Pas de nom pas d'ajout        
67
        if (!empty($_POST["name"])){
68
                $newID=$user->add($_POST);
69
                logEvent($newID, "users", 4, "setup", $_SESSION["glpiname"]." ".$LANG["log"][20]." ".$_POST["name"].".");
70
        }
71
        glpi_header($_SERVER['HTTP_REFERER']);
72
} else if (isset($_POST["delete"])) {
73
        checkRight("user","w");
74

    
75
        $user->delete($_POST);
76
        logEvent(0,"users", 4, "setup", $_SESSION["glpiname"]."  ".$LANG["log"][22]." ".$_POST["ID"].".");
77
        glpi_header($CFG_GLPI["root_doc"]."/front/user.php");
78
} else if (isset($_POST["restore"]))
79
{
80
        checkRight("user","w");
81
        $user->restore($_POST);
82
        logEvent($_POST["ID"],"users", 4, "setup", $_SESSION["glpiname"]." ".$LANG["log"][23]);
83
        glpi_header($CFG_GLPI["root_doc"]."/front/user.php");
84
}
85
else if (isset($_POST["purge"]))
86
{
87
        checkRight("user","w");
88
        $user->delete($_POST,1);
89
        
90
        logEvent($_POST["ID"], "users", 4, "setup", $_SESSION["glpiname"]." ".$LANG["log"][24]);
91
        glpi_header($CFG_GLPI["root_doc"]."/front/user.php");
92

    
93
} else if (isset ($_POST["force_ldap_resynch"]))
94
{
95
        checkSeveralRightsAnd(array("user"=>"w", "user_auth_method"=>"w"));
96
        
97
        $user->getFromDB($_POST["ID"]);
98
        ldapImportUserByServerId($user->fields["name"],1,$user->fields["id_auth"]);
99
        glpi_header($_SERVER['HTTP_REFERER']);
100
} else if (isset($_POST["update"])) {
101
        checkRight("user","w");
102

    
103
        $user->update($_POST);
104
        logEvent(0,"users", 5, "setup", $_SESSION["glpiname"]."  ".$LANG["log"][21]."  ".$_POST["name"].".");
105
        glpi_header($_SERVER['HTTP_REFERER']);
106
} else if (isset($_POST["addgroup"]))
107
{
108
        checkRight("user","w");
109

    
110
        addUserGroup($_POST["FK_users"],$_POST["FK_groups"]);
111

    
112
        logEvent($_POST["FK_users"], "users", 4, "setup", $_SESSION["glpiname"]." ".$LANG["log"][48]);
113
        glpi_header($_SERVER['HTTP_REFERER']);
114
}
115
else if (isset($_POST["deletegroup"]))
116
{
117
        checkRight("user","w");
118
        if (count($_POST["item"]))
119
                foreach ($_POST["item"] as $key => $val)
120
                        deleteUserGroup($key);
121

    
122
        logEvent($_POST["FK_users"], "users", 4, "setup", $_SESSION["glpiname"]." ".$LANG["log"][49]);
123
        glpi_header($_SERVER['HTTP_REFERER']);
124
} else if (isset($_POST["addright"]))
125
{
126
        checkRight("user","w");
127

    
128
        addUserProfileEntity($_POST);
129

    
130
        logEvent($_POST["FK_users"], "users", 4, "setup", $_SESSION["glpiname"]." ".$LANG["log"][61]);
131
        glpi_header($_SERVER['HTTP_REFERER']);
132
} else if (isset($_POST["deleteright"]))
133
{
134
        checkRight("user","w");
135

    
136
        if (isset($_POST["item"])&&count($_POST["item"])){
137
                foreach ($_POST["item"] as $key => $val){
138
                        deleteUserProfileEntity($key);
139
                }
140
                logEvent($_POST["FK_users"], "users", 4, "setup", $_SESSION["glpiname"]." ".$LANG["log"][62]);
141
        }
142

    
143
        glpi_header($_SERVER['HTTP_REFERER']);
144
}elseif (isset($_POST["switch_auth_internal"]))
145
{
146
        checkSeveralRightsAnd(array("user"=>"w", "user_auth_method"=>"w"));
147
        
148
        $user = new User;
149
        $input["ID"]=$_POST["ID"];
150
        $input["auth_method"]=AUTH_DB_GLPI;
151
        $input["id_auth"]=0;
152
        $user->update($input);
153
        glpi_header($_SERVER['HTTP_REFERER']);
154
}elseif (isset($_POST["switch_auth_ldap"]))
155
{
156
        checkSeveralRightsAnd(array("user"=>"w", "user_auth_method"=>"w"));
157
        
158
        $user = new User;
159
        $input["ID"]=$_POST["ID"];
160
        $input["auth_method"]=AUTH_LDAP;
161
        $input["id_auth"]=$_POST["id_auth"];
162
        $user->update($input);
163
        glpi_header($_SERVER['HTTP_REFERER']);        
164
}elseif (isset($_POST["switch_auth_mail"]))
165
{
166
        checkSeveralRightsAnd(array("user"=>"w", "user_auth_method"=>"w"));
167
        
168
        $user = new User;
169
        $input["ID"]=$_POST["ID"];
170
        $input["auth_method"]=AUTH_MAIL;
171
        $input["id_auth"]=$_POST["id_auth"];
172
        $user->update($input);
173
        glpi_header($_SERVER['HTTP_REFERER']);        
174
} else {
175

    
176

    
177
        if (!isset($_SESSION['glpi_onglet'])) $_SESSION['glpi_onglet']=1;
178
        if (isset($_GET['onglet'])) {
179
                $_SESSION['glpi_onglet']=$_GET['onglet'];
180
        }
181

    
182

    
183
        if (!isset($_GET["ext_auth"])){
184
                checkRight("user","r");
185

    
186
                commonHeader($LANG["title"][13],$_SERVER['PHP_SELF'],"admin","user");
187

    
188
                if ($user->showForm($_SERVER['PHP_SELF'],$_GET["ID"])){
189
                        if (!empty($_GET["ID"]))
190
                        switch($_SESSION['glpi_onglet']){
191
                                case -1:
192
                                        showUserRights($_SERVER['PHP_SELF'],$_GET["ID"]);
193
                                        showGroupAssociated($_SERVER['PHP_SELF'],$_GET["ID"]);
194
                                        showDeviceUser($_GET["ID"]);
195
                                        showUserReservations($_SERVER['PHP_SELF'],$_GET["ID"]);
196
                                        if (haveRight("show_all_ticket", "1")){
197
                                                showTrackingList($_SERVER['PHP_SELF'],$_GET["start"],$_GET["sort"],$_GET["order"],"all",'','',$_GET["ID"],0);
198
                                        }
199
                                        displayPluginAction(USER_TYPE,$_GET["ID"],$_SESSION['glpi_onglet']);
200
                                        break;
201
                                case 1 :
202
                                        showUserRights($_SERVER['PHP_SELF'],$_GET["ID"]);
203
                                        break;
204
                                case 2 :
205
                                        showDeviceUser($_GET["ID"]);
206
                                        break;
207
                                case 3 :
208
                                        showTrackingList($_SERVER['PHP_SELF'],$_GET["start"],$_GET["sort"],$_GET["order"],"all",'','',$_GET["ID"],0);
209
                                        break;
210
                                case 4 :
211
                                        showGroupAssociated($_SERVER['PHP_SELF'],$_GET["ID"]);
212
                                        break;
213
                                case 11 :
214
                                        showUserReservations($_SERVER['PHP_SELF'],$_GET["ID"]);
215
                                        break;
216
                                case 12:
217
                                        showSynchronizationForm($_SERVER['PHP_SELF'],$_GET["ID"]);
218
                                        break;
219
                                default : 
220
                                        if (!displayPluginAction(USER_TYPE,$_GET["ID"],$_SESSION['glpi_onglet']))
221
                                                showGroupAssociated($_SERVER['PHP_SELF'],$_GET["ID"]);
222
                                        break;
223
                        }
224
                        
225
                }
226
                commonFooter();
227
        } else {
228
                checkRight("user","w");
229
                
230
                if (isset($_GET['add_ext_auth_ldap'])){
231
                        if (isset($_GET['login'])&&!empty($_GET['login'])){
232
                                import_user_from_ldap_servers($_GET['login']);
233
                        }
234
                        glpi_header($_SERVER['HTTP_REFERER']);
235
                }
236
                if (isset($_GET['add_ext_auth_simple'])){
237
                        if (isset($_GET['login'])&&!empty($_GET['login'])){
238
                                $user->add(array('name'=>$_GET['login'],'_extauth'=>1));
239
                        }
240
                        glpi_header($_SERVER['HTTP_REFERER']);
241
                }
242

    
243
                commonHeader($LANG["title"][13],$_SERVER['PHP_SELF'],"admin","user");
244
                showAddExtAuthUserForm($_SERVER['PHP_SELF']);
245
                commonFooter();
246
        }
247
}
248

    
249

    
250

    
251

    
252

    
253
?>
Redmine Appliance - Powered by TurnKey Linux