@@ -212,10 +212,18 @@ public function getOrg($ignorecache = false)
212212 *
213213 * @param string $firstname
214214 */
215- public function setFirstname ($ firstname )
215+ public function setFirstname ($ firstname, $ operator = null )
216216 {
217217 $ ldap_user = $ this ->getLDAPUser ();
218218 $ ldap_user ->setAttribute ("givenname " , $ firstname );
219+ $ operator = is_null ($ operator ) ? $ this ->getUID () : $ operator ->getUID ();
220+
221+ $ this ->SQL ->addLog (
222+ $ operator ,
223+ $ _SERVER ['REMOTE_ADDR ' ],
224+ "firstname_changed " ,
225+ $ this ->getUID ()
226+ );
219227
220228 if (!$ ldap_user ->write ()) {
221229 throw new Exception ("Error updating LDAP entry $ this ->uid " );
@@ -256,10 +264,18 @@ public function getFirstname($ignorecache = false)
256264 *
257265 * @param string $lastname
258266 */
259- public function setLastname ($ lastname )
267+ public function setLastname ($ lastname, $ operator = null )
260268 {
261269 $ ldap_user = $ this ->getLDAPUser ();
262270 $ ldap_user ->setAttribute ("sn " , $ lastname );
271+ $ operator = is_null ($ operator ) ? $ this ->getUID () : $ operator ->getUID ();
272+
273+ $ this ->SQL ->addLog (
274+ $ operator ,
275+ $ _SERVER ['REMOTE_ADDR ' ],
276+ "lastname_changed " ,
277+ $ this ->getUID ()
278+ );
263279
264280 if (!$ this ->getLDAPUser ()->write ()) {
265281 throw new Exception ("Error updating LDAP entry $ this ->uid " );
@@ -305,10 +321,18 @@ public function getFullname()
305321 *
306322 * @param string $mail
307323 */
308- public function setMail ($ email )
324+ public function setMail ($ email, $ operator = null )
309325 {
310326 $ ldap_user = $ this ->getLDAPUser ();
311327 $ ldap_user ->setAttribute ("mail " , $ email );
328+ $ operator = is_null ($ operator ) ? $ this ->getUID () : $ operator ->getUID ();
329+
330+ $ this ->SQL ->addLog (
331+ $ operator ,
332+ $ _SERVER ['REMOTE_ADDR ' ],
333+ "email_changed " ,
334+ $ this ->getUID ()
335+ );
312336
313337 if (!$ this ->getLDAPUser ()->write ()) {
314338 throw new Exception ("Error updating LDAP entry $ this ->uid " );
@@ -420,7 +444,7 @@ public function getSSHKeys($ignorecache = false)
420444 *
421445 * @param string $shell absolute path to shell
422446 */
423- public function setLoginShell ($ shell , $ send_mail = true )
447+ public function setLoginShell ($ shell , $ operator = null , $ send_mail = true )
424448 {
425449 $ ldapUser = $ this ->getLDAPUser ();
426450 if ($ ldapUser ->exists ()) {
@@ -430,6 +454,15 @@ public function setLoginShell($shell, $send_mail = true)
430454 }
431455 }
432456
457+ $ operator = is_null ($ operator ) ? $ this ->getUID () : $ operator ->getUID ();
458+
459+ $ this ->SQL ->addLog (
460+ $ operator ,
461+ $ _SERVER ['REMOTE_ADDR ' ],
462+ "loginshell_changed " ,
463+ $ this ->getUID ()
464+ );
465+
433466 $ this ->REDIS ->setCache ($ this ->uid , "loginshell " , $ shell );
434467
435468 if ($ send_mail ) {
@@ -470,7 +503,7 @@ public function getLoginShell($ignorecache = false)
470503 return null ;
471504 }
472505
473- public function setHomeDir ($ home )
506+ public function setHomeDir ($ home, $ operator = null )
474507 {
475508 $ ldapUser = $ this ->getLDAPUser ();
476509 if ($ ldapUser ->exists ()) {
@@ -479,6 +512,15 @@ public function setHomeDir($home)
479512 throw new Exception ("Failed to modify home directory for $ this ->uid " );
480513 }
481514
515+ $ operator = is_null ($ operator ) ? $ this ->getUID () : $ operator ->getUID ();
516+
517+ $ this ->SQL ->addLog (
518+ $ operator ,
519+ $ _SERVER ['REMOTE_ADDR ' ],
520+ "homedir_changed " ,
521+ $ this ->getUID ()
522+ );
523+
482524 $ this ->REDIS ->setCache ($ this ->uid , "homedir " , $ home );
483525 }
484526 }
0 commit comments