Skip to content

Commit

Permalink
FIX When salary module is not enabled, bad permission check on user list
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed May 22, 2023
1 parent 55ca2ab commit 42bebf3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions htdocs/user/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@

$acceptlocallinktomedia = (acceptLocalLinktoMedia() > 0 ? 1 : 0);

if ($id > 0) {
$res = $object->fetch($id, '', '', 1);
}

// Security check
$socid = 0;
Expand Down
2 changes: 1 addition & 1 deletion htdocs/user/hierarchy.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
$canadduser = (!empty($user->admin) || $user->hasRight("user", "user", "write"));

// Permission to list
if ($contextpage == 'employeelist' && $search_employee == 1) {
if (isModEnabled('salaries') && $contextpage == 'employeelist' && $search_employee == 1) {
if (!$user->hasRight("salaries", "read")) {
accessforbidden();
}
Expand Down
4 changes: 2 additions & 2 deletions htdocs/user/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@
$error = 0;

// Permission to list
if ($contextpage == 'employeelist' && $search_employee == 1) {
if (isModEnabled('salaries') && $contextpage == 'employeelist' && $search_employee == 1) {
if (!$user->hasRight("salaries", "read")) {
accessforbidden();
}
Expand Down Expand Up @@ -478,7 +478,7 @@
if ($search_warehouse > 0) {
$sql .= " AND u.fk_warehouse = ".((int) $search_warehouse);
}
if ($contextpage == 'employeelist' && !$user->hasRight("salaries", "readall")) {
if (isModEnabled('salaries') && $contextpage == 'employeelist' && !$user->hasRight("salaries", "readall")) {
$sql .= " AND u.rowid IN (".$db->sanitize(join(',', $childids)).")";
}
// Add where from extra fields
Expand Down

0 comments on commit 42bebf3

Please sign in to comment.