|
@@ -17,7 +17,7 @@ discard block |
|
|
block discarded – undo |
|
17
|
17
|
$data = array(); |
|
18
|
18
|
$data['faculty'] = $this->temporary_account_model->get_faculty(); |
|
19
|
19
|
$data['department'] = $this->temporary_account_model->get_department(); |
|
20
|
|
- $data['tempid'] = "tempuser" . $this->temporary_account_model->get_next_temp(); |
|
|
20
|
+ $data['tempid'] = "tempuser".$this->temporary_account_model->get_next_temp(); |
|
21
|
21
|
|
|
22
|
22
|
//validation |
|
23
|
23
|
$this->form_validation->set_rules('faculty', 'Faculty', 'trim|required'); |
|
@@ -47,10 +47,10 @@ discard block |
|
|
block discarded – undo |
|
47
|
47
|
$this->email->from('[email protected]', 'Temporary Logon Account Request'); |
|
48
|
48
|
$this->email->to('[email protected]'); |
|
49
|
49
|
$this->email->subject('Temporary Logon Account Request'); |
|
50
|
|
- $this->email->message('A temporary network account has been requested by ' . $_SESSION['ldap']['full_name'] |
|
51
|
|
- . ' for ' . $this->input->post('requester') |
|
|
50
|
+ $this->email->message('A temporary network account has been requested by '.$_SESSION['ldap']['full_name'] |
|
|
51
|
+ . ' for '.$this->input->post('requester') |
|
52
|
52
|
. '' |
|
53
|
|
- . 'the user will be: ' . $this->input->post('first_name') . ' ' . $this->input->post('last_name') |
|
|
53
|
+ . 'the user will be: '.$this->input->post('first_name').' '.$this->input->post('last_name') |
|
54
|
54
|
. '' |
|
55
|
55
|
. 'Approve https://intranet.cant-col.ac.uk/dashboard/computing-support/temporary-account/approve'); |
|
56
|
56
|
$this->email->send(); |
|
@@ -123,7 +123,7 @@ discard block |
|
|
block discarded – undo |
|
123
|
123
|
$id = $_GET['id']; |
|
124
|
124
|
$this->temporary_account_model->cancel($id); |
|
125
|
125
|
|
|
126
|
|
- $function = 'temp_account_CANCEL_' . $id; |
|
|
126
|
+ $function = 'temp_account_CANCEL_'.$id; |
|
127
|
127
|
$this->user_model->function_log($function); |
|
128
|
128
|
|
|
129
|
129
|
redirect($_SERVER['HTTP_REFERER']); |
|
@@ -143,7 +143,7 @@ discard block |
|
|
block discarded – undo |
|
143
|
143
|
$id = $_GET['id']; |
|
144
|
144
|
$this->temporary_account_model->reject($id); |
|
145
|
145
|
|
|
146
|
|
- $function = 'temp_account_REJECT_' . $id; |
|
|
146
|
+ $function = 'temp_account_REJECT_'.$id; |
|
147
|
147
|
$this->user_model->function_log($function); |
|
148
|
148
|
|
|
149
|
149
|
redirect($_SERVER['HTTP_REFERER']); |
|
@@ -164,7 +164,7 @@ discard block |
|
|
block discarded – undo |
|
164
|
164
|
$id = $_GET['id']; |
|
165
|
165
|
//$this->temporary_account_model->approve($id); |
|
166
|
166
|
|
|
167
|
|
- $function = 'temp_account_APPROVED_' . $id; |
|
|
167
|
+ $function = 'temp_account_APPROVED_'.$id; |
|
168
|
168
|
$this->user_model->function_log($function); |
|
169
|
169
|
|
|
170
|
170
|
$data = array(); |
|
@@ -180,12 +180,12 @@ discard block |
|
|
block discarded – undo |
|
180
|
180
|
|
|
181
|
181
|
//Format dd-mm-yyyy |
|
182
|
182
|
//Expiry is beginning of day (thats why +1 day |
|
183
|
|
- $dateFromForm = date('d-m-Y', strtotime($data['AD'][0]['expiry']. ' +1 day')); |
|
|
183
|
+ $dateFromForm = date('d-m-Y', strtotime($data['AD'][0]['expiry'].' +1 day')); |
|
184
|
184
|
|
|
185
|
185
|
//Format hh:mm:ss |
|
186
|
186
|
$timeFromForm = "00:00:00"; |
|
187
|
187
|
|
|
188
|
|
- $dateWithTime = $dateFromForm . " " . $timeFromForm; |
|
|
188
|
+ $dateWithTime = $dateFromForm." ".$timeFromForm; |
|
189
|
189
|
|
|
190
|
190
|
function convertDateToUnix($input) { |
|
191
|
191
|
$format = 'd-m-Y H:i:s'; |
|
@@ -202,7 +202,7 @@ discard block |
|
|
block discarded – undo |
|
202
|
202
|
//$WIN = convertUnixtoWin($UNIX); |
|
203
|
203
|
|
|
204
|
204
|
//Create Unicode password |
|
205
|
|
- $passwordWithQuotes = '"' . $data['AD'][0]['password'] . '"'; |
|
|
205
|
+ $passwordWithQuotes = '"'.$data['AD'][0]['password'].'"'; |
|
206
|
206
|
$ldaprecord["unicodepwd"] = iconv('UTF-8', 'UTF-16LE', $passwordWithQuotes); |
|
207
|
207
|
|
|
208
|
208
|
//Build Active Directory record |
|
@@ -211,20 +211,20 @@ discard block |
|
|
block discarded – undo |
|
211
|
211
|
$ldaprecord["sn"] = $data['AD'][0]['last_name']; |
|
212
|
212
|
$ldaprecord["mail"] = $data['AD'][0]['email']; |
|
213
|
213
|
$ldaprecord["sAMAccountName"] = $data['AD'][0]['username']; |
|
214
|
|
- $ldaprecord["displayName"] = $data['AD'][0]['first_name'] . " " . $data['AD'][0]['last_name']; |
|
|
214
|
+ $ldaprecord["displayName"] = $data['AD'][0]['first_name']." ".$data['AD'][0]['last_name']; |
|
215
|
215
|
$ldaprecord["l"] = "Canterbury"; |
|
216
|
|
- $ldaprecord["description"] = "Temp account created by dashboard for " . $ldaprecord["displayName"]; |
|
|
216
|
+ $ldaprecord["description"] = "Temp account created by dashboard for ".$ldaprecord["displayName"]; |
|
217
|
217
|
//$ldaprecord["accountExpires"] = $WIN; |
|
218
|
218
|
$ldaprecord["UserAccountControl"] = "512"; //512 - Enabled Account |
|
219
|
|
- $ldaprecord['userPrincipalName'] = $data['AD'][0]['username'] . '@cant-col.ac.uk'; |
|
|
219
|
+ $ldaprecord['userPrincipalName'] = $data['AD'][0]['username'].'@cant-col.ac.uk'; |
|
220
|
220
|
$ldaprecord['objectclass'][0] = "top"; |
|
221
|
221
|
$ldaprecord['objectclass'][1] = "person"; |
|
222
|
222
|
$ldaprecord['objectclass'][2] = "organizationalPerson"; |
|
223
|
223
|
$ldaprecord['objectclass'][3] = "user"; |
|
224
|
|
- $dn = 'CN=' . $ldaprecord["cn"] . ',OU=Temp Accounts,OU=Students,OU=Accounts,DC=cant-col,DC=ac,DC=uk'; |
|
|
224
|
+ $dn = 'CN='.$ldaprecord["cn"].',OU=Temp Accounts,OU=Students,OU=Accounts,DC=cant-col,DC=ac,DC=uk'; |
|
225
|
225
|
|
|
226
|
226
|
// Connect to Active Directory |
|
227
|
|
- $ds = ldap_connect('ldaps://' . $AD_server); |
|
|
227
|
+ $ds = ldap_connect('ldaps://'.$AD_server); |
|
228
|
228
|
|
|
229
|
229
|
if ($ds) { |
|
230
|
230
|
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3); |