Skip to content

Commit

Permalink
Merge branch '2.1.25.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsteampassnet committed Jan 31, 2016
2 parents 88ede56 + 8683593 commit e62fa82
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion sources/main.functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ function identifyUserRights($groupesVisiblesUser, $groupesInterditsUser, $isAdmi
"SELECT * FROM ".prefix_table("roles_title")."
ORDER BY title ASC");
foreach ($rows as $record) {
if (!in_array($record['id'], $tmp)) {
if (!empty($record['id']) && !in_array($record['id'], $tmp)) {
array_push($tmp, $record['id']);
}
}
Expand Down
9 changes: 5 additions & 4 deletions sources/roles.queries.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,9 @@
$previous = 1;

//count nb of roles
if (empty($_SESSION['fonction_id'])) $where = "";
else $where = " WHERE id IN (".str_replace(";", ",", $_SESSION['fonction_id']).")";
$arrUserRoles = array_filter($_SESSION['user_roles']);
if (count($arrUserRoles) == 0) $where = "";
else $where = " WHERE id IN (".implode(',', $arrUserRoles).")";
DB::query("SELECT * FROM ".prefix_table("roles_title").$where);
$roles_count = DB::count();
if ($roles_count > $display_nb) {
Expand All @@ -247,12 +248,12 @@
}

// array of roles for actual user
$my_functions = explode(';', $_SESSION['fonction_id']);
$my_functions = $arrUserRoles;

//Display table header
$rows = DB::query(
"SELECT * FROM ".prefix_table("roles_title").
$where."
$where."
ORDER BY title ASC".$sql_limit);
foreach ($rows as $record) {
if ($_SESSION['is_admin'] == 1 || ($_SESSION['user_manager'] == 1 && (in_array($record['id'], $my_functions) || $record['creator_id'] == $_SESSION['user_id']))) {
Expand Down

0 comments on commit e62fa82

Please sign in to comment.