Clean code

This commit is contained in:
Laurent Destailleur 2021-12-19 17:25:11 +01:00
parent 40a3f70eb3
commit b6cfc3a3e0

View File

@ -90,12 +90,10 @@ if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
$childids = $user->getAllChildIds(1); // For later, test on salary visibility
// Define value to know what current user can do on properties of edited user
if ($id) {
if ($id > 0) {
// $user is the current logged user, $id is the user we want to edit
$caneditfield = ((($user->id == $id) && $user->rights->user->self->creer)
|| (($user->id != $id) && $user->rights->user->user->creer));
$caneditpassword = ((($user->id == $id) && $user->rights->user->self->password)
|| (($user->id != $id) && $user->rights->user->user->password));
$caneditfield = ((($user->id == $id) && $user->rights->user->self->creer) || (($user->id != $id) && $user->rights->user->user->creer));
$caneditpassword = ((($user->id == $id) && $user->rights->user->self->password) || (($user->id != $id) && $user->rights->user->user->password));
}
// Security check
@ -106,7 +104,7 @@ if ($user->socid > 0) {
$feature2 = 'user';
$result = restrictedArea($user, 'user', $id, 'user', $feature2);
if ($user->id <> $id && !$canreaduser) {
if ($user->id != $id && !$canreaduser) {
accessforbidden();
}