|
1
|
|
|
<?php |
|
2
|
1 |
|
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3
|
|
|
/********************************************************************************* |
|
4
|
|
|
* SugarCRM Community Edition is a customer relationship management program developed by |
|
5
|
|
|
* SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
|
6
|
|
|
|
|
7
|
|
|
* SuiteCRM is an extension to SugarCRM Community Edition developed by Salesagility Ltd. |
|
8
|
|
|
* Copyright (C) 2011 - 2014 Salesagility Ltd. |
|
9
|
|
|
* |
|
10
|
|
|
* This program is free software; you can redistribute it and/or modify it under |
|
11
|
|
|
* the terms of the GNU Affero General Public License version 3 as published by the |
|
12
|
|
|
* Free Software Foundation with the addition of the following permission added |
|
13
|
|
|
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK |
|
14
|
|
|
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY |
|
15
|
|
|
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. |
|
16
|
|
|
* |
|
17
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT |
|
18
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
|
19
|
|
|
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more |
|
20
|
|
|
* details. |
|
21
|
|
|
* |
|
22
|
|
|
* You should have received a copy of the GNU Affero General Public License along with |
|
23
|
|
|
* this program; if not, see http://www.gnu.org/licenses or write to the Free |
|
24
|
|
|
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
25
|
|
|
* 02110-1301 USA. |
|
26
|
|
|
* |
|
27
|
|
|
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road, |
|
28
|
|
|
* SW2-130, Cupertino, CA 95014, USA. or at email address [email protected]. |
|
29
|
|
|
* |
|
30
|
|
|
* The interactive user interfaces in modified source and object code versions |
|
31
|
|
|
* of this program must display Appropriate Legal Notices, as required under |
|
32
|
|
|
* Section 5 of the GNU Affero General Public License version 3. |
|
33
|
|
|
* |
|
34
|
|
|
* In accordance with Section 7(b) of the GNU Affero General Public License version 3, |
|
35
|
|
|
* these Appropriate Legal Notices must retain the display of the "Powered by |
|
36
|
|
|
* SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not |
|
37
|
|
|
* reasonably feasible for technical reasons, the Appropriate Legal Notices must |
|
38
|
|
|
* display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM". |
|
39
|
|
|
********************************************************************************/ |
|
40
|
|
|
|
|
41
|
|
|
/********************************************************************************* |
|
42
|
|
|
|
|
43
|
|
|
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. |
|
44
|
|
|
* All Rights Reserved. |
|
45
|
|
|
* Contributor(s): ______________________________________.. |
|
46
|
|
|
********************************************************************************/ |
|
47
|
1 |
|
require_once("include/OutboundEmail/OutboundEmail.php"); |
|
48
|
|
|
|
|
49
|
|
|
class UsersController extends SugarController |
|
50
|
|
|
{ |
|
51
|
|
|
/** |
|
52
|
|
|
* bug 48170 |
|
53
|
|
|
* Action resetPreferences gets fired when user clicks on 'Reset User Preferences' button |
|
54
|
|
|
* This action is set in UserViewHelper.php |
|
55
|
|
|
*/ |
|
56
|
|
|
protected function action_resetPreferences(){ |
|
57
|
|
|
if($_REQUEST['record'] == $GLOBALS['current_user']->id || ($GLOBALS['current_user']->isAdminForModule('Users'))){ |
|
58
|
|
|
$u = new User(); |
|
59
|
|
|
$u->retrieve($_REQUEST['record']); |
|
60
|
|
|
$u->resetPreferences(); |
|
61
|
|
|
if($u->id == $GLOBALS['current_user']->id) { |
|
62
|
|
|
SugarApplication::redirect('index.php'); |
|
63
|
|
|
} |
|
64
|
|
|
else{ |
|
65
|
|
|
SugarApplication::redirect("index.php?module=Users&record=".$_REQUEST['record']."&action=DetailView"); //bug 48170] |
|
66
|
|
|
|
|
67
|
|
|
} |
|
68
|
|
|
} |
|
69
|
|
|
} |
|
70
|
|
|
protected function action_delete() |
|
71
|
|
|
{ |
|
72
|
|
|
if($_REQUEST['record'] != $GLOBALS['current_user']->id && ($GLOBALS['current_user']->isAdminForModule('Users') |
|
73
|
|
|
)) |
|
74
|
|
|
{ |
|
75
|
|
|
$u = new User(); |
|
76
|
|
|
$u->retrieve($_REQUEST['record']); |
|
77
|
|
|
$u->status = 'Inactive'; |
|
78
|
|
|
$u->employee_status = 'Terminated'; |
|
79
|
|
|
$u->save(); |
|
80
|
|
|
$u->mark_deleted($u->id); |
|
81
|
|
|
$GLOBALS['log']->info("User id: {$GLOBALS['current_user']->id} deleted user record: {$_REQUEST['record']}"); |
|
82
|
|
|
|
|
83
|
|
|
$eapm = loadBean('EAPM'); |
|
|
|
|
|
|
84
|
|
|
$eapm->delete_user_accounts($_REQUEST['record']); |
|
85
|
|
|
$GLOBALS['log']->info("Removing user's External Accounts"); |
|
86
|
|
|
|
|
87
|
|
|
SugarApplication::redirect("index.php?module=Users&action=index"); |
|
88
|
|
|
} |
|
89
|
|
|
else |
|
90
|
|
|
sugar_die("Unauthorized access to administration."); |
|
91
|
|
|
} |
|
92
|
|
|
protected function action_wizard() |
|
93
|
|
|
{ |
|
94
|
|
|
$this->view = 'wizard'; |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
protected function action_saveuserwizard() |
|
98
|
|
|
{ |
|
99
|
|
|
global $current_user, $sugar_config; |
|
100
|
|
|
|
|
101
|
|
|
// set all of these default parameters since the Users save action will undo the defaults otherwise |
|
102
|
|
|
$_POST['record'] = $current_user->id; |
|
103
|
|
|
$_POST['is_admin'] = ( $current_user->is_admin ? 'on' : '' ); |
|
104
|
|
|
$_POST['use_real_names'] = true; |
|
105
|
|
|
$_POST['reminder_checked'] = '1'; |
|
106
|
|
|
$_POST['email_reminder_checked'] = '1'; |
|
107
|
|
|
$_POST['reminder_time'] = 1800; |
|
108
|
|
|
$_POST['email_reminder_time'] = 3600; |
|
109
|
|
|
$_POST['mailmerge_on'] = 'on'; |
|
110
|
|
|
$_POST['receive_notifications'] = $current_user->receive_notifications; |
|
111
|
|
|
$_POST['user_theme'] = (string) SugarThemeRegistry::getDefault(); |
|
112
|
|
|
|
|
113
|
|
|
// save and redirect to new view |
|
114
|
|
|
$_REQUEST['return_module'] = 'Home'; |
|
115
|
|
|
$_REQUEST['return_action'] = 'index'; |
|
116
|
|
|
require('modules/Users/Save.php'); |
|
117
|
|
|
} |
|
118
|
|
|
|
|
119
|
|
|
protected function action_saveftsmodules() |
|
120
|
|
|
{ |
|
121
|
|
|
$this->view = 'fts'; |
|
122
|
|
|
$GLOBALS['current_user']->setPreference('fts_disabled_modules', $_REQUEST['disabled_modules']); |
|
123
|
|
|
} |
|
124
|
|
|
|
|
125
|
|
|
/** |
|
126
|
|
|
* action "save" (with a lower case S that is for OSX users ;-) |
|
127
|
|
|
* @see SugarController::action_save() |
|
128
|
|
|
*/ |
|
129
|
|
|
public function action_save() |
|
130
|
|
|
{ |
|
131
|
|
|
require 'modules/Users/Save.php'; |
|
132
|
|
|
} |
|
133
|
|
|
} |
|
134
|
|
|
|
|
135
|
|
|
|
This function has been deprecated. The supplier of the file has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed from the class and what other function to use instead.