function cacheEntities() { $user = $_SESSION['user']; $userToGroup = parse_ini_file('users-group.ini'); if (!array_key_exists($user, $userToGroup) || $userToGroup[$user] == "") { exit("Can not find group for user " . $user); } $entities = array(); $entityGroups = new EntityGroups(); try { $response = $entityGroups->findEntities($userToGroup[$user]); foreach ($response as $entity) { $entities[] = $entity["name"]; } $_SESSION['entities'] = $entities; } catch (Exception $e) { $matches = array(); preg_match_all("/^.*Exception: (.*\$)/", $e->getMessage(), $matches); $this->error = "ERROR: " . $matches[1][0]; } }
function cacheEntities() { $user = $_SESSION['user']; $userToGroup = parse_ini_file('users-group.ini'); if (!array_key_exists($user, $userToGroup) || $userToGroup[$user] == "") { exit("Can not find group for user " . $user); } $entities = array(); $entityGroups = new EntityGroups(); try { $response = $entityGroups->findEntities($userToGroup[$user]); if (!is_array($response)) { throw new Exception('Exception: "Can not execute findEntities query'); } foreach ($response as $entity) { $entities[] = $entity["name"]; } $_SESSION['entities'] = $entities; } catch (Exception $e) { $matches = array(); preg_match_all("/^.*Exception: (.*\$)/", $e->getMessage(), $matches); trigger_error("Can not get entities for group <b>" . $userToGroup[$user] . "<b> from ATSD server with the following message: " . $matches[1][0]); } }