The delete of a user need the parameter $user

This commit is contained in:
Laurent Destailleur 2018-12-22 17:34:27 +01:00
parent 7d1b48815d
commit 3fee4c3309
5 changed files with 14 additions and 12 deletions

View File

@ -149,7 +149,7 @@ if (empty($reshook)) {
if ($id <> $user->id) {
$object = new User($db);
$object->fetch($id);
$result = $object->delete();
$result = $object->delete($user);
if ($result < 0) {
$langs->load("errors");
setEventMessages($langs->trans("ErrorUserCannotBeDelete"), null, 'errors');
@ -1249,7 +1249,7 @@ else
$object->getrights();
if (empty($object->nb_rights) && $object->statut != 0 && empty($object->admin)) setEventMessages($langs->trans('UserHasNoPermissions'), null, 'warnings');
}
// Connexion ldap
// pour recuperer passDoNotExpire et userChangePassNextLogon
if (! empty($conf->ldap->enabled) && ! empty($object->ldap_sid))

View File

@ -302,7 +302,7 @@ class Users extends DolibarrApi
throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
}
return $this->useraccount->delete($id);
return $this->useraccount->delete(DolibarrApiAccess::$user);
}
/**

View File

@ -1005,13 +1005,14 @@ class User extends CommonObject
}
/**
* Delete the user
* Delete the user
*
* @return int <0 if KO, >0 if OK
* @param User $user User than delete
* @return int <0 if KO, >0 if OK
*/
function delete()
function delete(User $user)
{
global $user,$conf,$langs;
global $conf,$langs;
$error=0;

View File

@ -617,13 +617,14 @@ class UserGroup extends CommonObject
}
/**
* Efface un groupe de la base
* Delete a group
*
* @return <0 if KO, > 0 if OK
* @param User $user User that delete
* @return <0 if KO, > 0 if OK
*/
function delete()
function delete(User $user)
{
global $user,$conf,$langs;
global $conf,$langs;
$error=0;

View File

@ -110,7 +110,7 @@ if (empty($reshook)) {
if ($caneditperms)
{
$object->fetch($id);
$object->delete();
$object->delete($user);
header("Location: ".DOL_URL_ROOT."/user/group/list.php?restore_lastsearch_values=1");
exit;
}