Commit ad30ba424eae137887c35f09b21ea1dfc066ccf1

Authored by Eduardo Santos
2 parents b742aa8a 600973bd
Exists in master and in 1 other branch 3.1

Grande atualização para permitir a execução das conexões entre novo agente e gerente

app/bootstrap.php.cache
... ... @@ -95,7 +95,7 @@ public function getInt($key, $default = 0, $deep = false)
95 95 {
96 96 return (int) $this->get($key, $default, $deep);
97 97 }
98   -public function filter($key, $default = null, $deep = false, $filter=FILTER_DEFAULT, $options=array())
  98 +public function filter($key, $default = null, $deep = false, $filter = FILTER_DEFAULT, $options = array())
99 99 {
100 100 $value = $this->get($key, $default, $deep);
101 101 if (!is_array($options) && $options) {
... ... @@ -120,12 +120,10 @@ namespace Symfony\Component\HttpFoundation
120 120 {
121 121 class HeaderBag implements \IteratorAggregate, \Countable
122 122 {
123   -protected $headers;
124   -protected $cacheControl;
  123 +protected $headers = array();
  124 +protected $cacheControl = array();
125 125 public function __construct(array $headers = array())
126 126 {
127   -$this->cacheControl = array();
128   -$this->headers = array();
129 127 foreach ($headers as $key => $values) {
130 128 $this->set($key, $values);
131 129 }
... ... @@ -369,12 +367,12 @@ $authorizationHeader = $this->parameters['HTTP_AUTHORIZATION'];
369 367 $authorizationHeader = $this->parameters['REDIRECT_HTTP_AUTHORIZATION'];
370 368 }
371 369 if (null !== $authorizationHeader) {
372   -if (0 === stripos($authorizationHeader,'basic')) {
373   -$exploded = explode(':', base64_decode(substr($authorizationHeader, 6)));
  370 +if (0 === stripos($authorizationHeader,'basic ')) {
  371 +$exploded = explode(':', base64_decode(substr($authorizationHeader, 6)), 2);
374 372 if (count($exploded) == 2) {
375 373 list($headers['PHP_AUTH_USER'], $headers['PHP_AUTH_PW']) = $exploded;
376 374 }
377   -} elseif (empty($this->parameters['PHP_AUTH_DIGEST']) && (0 === stripos($authorizationHeader,'digest'))) {
  375 +} elseif (empty($this->parameters['PHP_AUTH_DIGEST']) && (0 === stripos($authorizationHeader,'digest '))) {
378 376 $headers['PHP_AUTH_DIGEST'] = $authorizationHeader;
379 377 $this->parameters['PHP_AUTH_DIGEST'] = $authorizationHeader;
380 378 }
... ... @@ -418,6 +416,7 @@ public $headers;
418 416 protected $content;
419 417 protected $languages;
420 418 protected $charsets;
  419 +protected $encodings;
421 420 protected $acceptableContentTypes;
422 421 protected $pathInfo;
423 422 protected $requestUri;
... ... @@ -429,6 +428,7 @@ protected $session;
429 428 protected $locale;
430 429 protected $defaultLocale ='en';
431 430 protected static $formats;
  431 +protected static $requestFactory;
432 432 public function __construct(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null)
433 433 {
434 434 $this->initialize($query, $request, $attributes, $cookies, $files, $server, $content);
... ... @@ -445,6 +445,7 @@ $this->headers = new HeaderBag($this->server->getHeaders());
445 445 $this->content = $content;
446 446 $this->languages = null;
447 447 $this->charsets = null;
  448 +$this->encodings = null;
448 449 $this->acceptableContentTypes = null;
449 450 $this->pathInfo = null;
450 451 $this->requestUri = null;
... ... @@ -455,7 +456,7 @@ $this->format = null;
455 456 }
456 457 public static function createFromGlobals()
457 458 {
458   -$request = new static($_GET, $_POST, array(), $_COOKIE, $_FILES, $_SERVER);
  459 +$request = self::createRequestFromFactory($_GET, $_POST, array(), $_COOKIE, $_FILES, $_SERVER);
459 460 if (0 === strpos($request->headers->get('CONTENT_TYPE'),'application/x-www-form-urlencoded')
460 461 && in_array(strtoupper($request->server->get('REQUEST_METHOD','GET')), array('PUT','DELETE','PATCH'))
461 462 ) {
... ... @@ -528,7 +529,11 @@ $queryString = http_build_query($query,'','&');
528 529 }
529 530 $server['REQUEST_URI'] = $components['path'].(''!== $queryString ?'?'.$queryString :'');
530 531 $server['QUERY_STRING'] = $queryString;
531   -return new static($query, $request, array(), $cookies, $files, $server, $content);
  532 +return self::createRequestFromFactory($query, $request, array(), $cookies, $files, $server, $content);
  533 +}
  534 +public static function setFactory($callable)
  535 +{
  536 +self::$requestFactory = $callable;
532 537 }
533 538 public function duplicate(array $query = null, array $request = null, array $attributes = null, array $cookies = null, array $files = null, array $server = null)
534 539 {
... ... @@ -554,6 +559,7 @@ $dup->headers = new HeaderBag($dup->server->getHeaders());
554 559 }
555 560 $dup->languages = null;
556 561 $dup->charsets = null;
  562 +$dup->encodings = null;
557 563 $dup->acceptableContentTypes = null;
558 564 $dup->pathInfo = null;
559 565 $dup->requestUri = null;
... ... @@ -588,6 +594,7 @@ $this->getContent();
588 594 }
589 595 public function overrideGlobals()
590 596 {
  597 +$this->server->set('QUERY_STRING', static::normalizeQueryString(http_build_query($this->query->all(), null,'&')));
591 598 $_GET = $this->query->all();
592 599 $_POST = $this->request->all();
593 600 $_SERVER = $this->server->all();
... ... @@ -753,7 +760,12 @@ return 443;
753 760 }
754 761 }
755 762 if ($host = $this->headers->get('HOST')) {
756   -if (false !== $pos = strrpos($host,':')) {
  763 +if ($host[0] ==='[') {
  764 +$pos = strpos($host,':', strrpos($host,']'));
  765 +} else {
  766 +$pos = strrpos($host,':');
  767 +}
  768 +if (false !== $pos) {
757 769 return intval(substr($host, $pos + 1));
758 770 }
759 771 return'https'=== $this->getScheme() ? 443 : 80;
... ... @@ -762,11 +774,11 @@ return $this->server->get('SERVER_PORT');
762 774 }
763 775 public function getUser()
764 776 {
765   -return $this->server->get('PHP_AUTH_USER');
  777 +return $this->headers->get('PHP_AUTH_USER');
766 778 }
767 779 public function getPassword()
768 780 {
769   -return $this->server->get('PHP_AUTH_PW');
  781 +return $this->headers->get('PHP_AUTH_PW');
770 782 }
771 783 public function getUserInfo()
772 784 {
... ... @@ -818,7 +830,8 @@ public function isSecure()
818 830 if (self::$trustedProxies && self::$trustedHeaders[self::HEADER_CLIENT_PROTO] && $proto = $this->headers->get(self::$trustedHeaders[self::HEADER_CLIENT_PROTO])) {
819 831 return in_array(strtolower(current(explode(',', $proto))), array('https','on','ssl','1'));
820 832 }
821   -return'on'== strtolower($this->server->get('HTTPS')) || 1 == $this->server->get('HTTPS');
  833 +$https = $this->server->get('HTTPS');
  834 +return !empty($https) &&'off'!== strtolower($https);
822 835 }
823 836 public function getHost()
824 837 {
... ... @@ -831,8 +844,8 @@ $host = $this->server->get('SERVER_ADDR','');
831 844 }
832 845 }
833 846 $host = strtolower(preg_replace('/:\d+$/','', trim($host)));
834   -if ($host && !preg_match('/^\[?(?:[a-zA-Z0-9-:\]_]+\.?)+$/', $host)) {
835   -throw new \UnexpectedValueException('Invalid Host "'.$host.'"');
  847 +if ($host &&''!== preg_replace('/(?:^\[)?[a-zA-Z0-9-:\]_]+\.?/','', $host)) {
  848 +throw new \UnexpectedValueException(sprintf('Invalid Host "%s"', $host));
836 849 }
837 850 if (count(self::$trustedHostPatterns) > 0) {
838 851 if (in_array($host, self::$trustedHosts)) {
... ... @@ -844,7 +857,7 @@ self::$trustedHosts[] = $host;
844 857 return $host;
845 858 }
846 859 }
847   -throw new \UnexpectedValueException('Untrusted Host "'.$host.'"');
  860 +throw new \UnexpectedValueException(sprintf('Untrusted Host "%s"', $host));
848 861 }
849 862 return $host;
850 863 }
... ... @@ -891,7 +904,6 @@ if (in_array($mimeType, (array) $mimeTypes)) {
891 904 return $format;
892 905 }
893 906 }
894   -return null;
895 907 }
896 908 public function setFormat($format, $mimeTypes)
897 909 {
... ... @@ -922,6 +934,10 @@ if (null === $this->locale) {
922 934 $this->setPhpDefaultLocale($locale);
923 935 }
924 936 }
  937 +public function getDefaultLocale()
  938 +{
  939 +return $this->defaultLocale;
  940 +}
925 941 public function setLocale($locale)
926 942 {
927 943 $this->setPhpDefaultLocale($this->locale = $locale);
... ... @@ -1017,6 +1033,13 @@ return $this->charsets;
1017 1033 }
1018 1034 return $this->charsets = array_keys(AcceptHeader::fromString($this->headers->get('Accept-Charset'))->all());
1019 1035 }
  1036 +public function getEncodings()
  1037 +{
  1038 +if (null !== $this->encodings) {
  1039 +return $this->encodings;
  1040 +}
  1041 +return $this->encodings = array_keys(AcceptHeader::fromString($this->headers->get('Accept-Encoding'))->all());
  1042 +}
1020 1043 public function getAcceptableContentTypes()
1021 1044 {
1022 1045 if (null !== $this->acceptableContentTypes) {
... ... @@ -1161,12 +1184,65 @@ return $match[0];
1161 1184 }
1162 1185 return false;
1163 1186 }
  1187 +private static function createRequestFromFactory(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null)
  1188 +{
  1189 +if (self::$requestFactory) {
  1190 +$request = call_user_func(self::$requestFactory, $query, $request, $attributes, $cookies, $files, $server, $content);
  1191 +if (!$request instanceof Request) {
  1192 +throw new \LogicException('The Request factory must return an instance of Symfony\Component\HttpFoundation\Request.');
  1193 +}
  1194 +return $request;
  1195 +}
  1196 +return new static($query, $request, $attributes, $cookies, $files, $server, $content);
  1197 +}
1164 1198 }
1165 1199 }
1166 1200 namespace Symfony\Component\HttpFoundation
1167 1201 {
1168 1202 class Response
1169 1203 {
  1204 +const HTTP_CONTINUE = 100;
  1205 +const HTTP_SWITCHING_PROTOCOLS = 101;
  1206 +const HTTP_PROCESSING = 102; const HTTP_OK = 200;
  1207 +const HTTP_CREATED = 201;
  1208 +const HTTP_ACCEPTED = 202;
  1209 +const HTTP_NON_AUTHORITATIVE_INFORMATION = 203;
  1210 +const HTTP_NO_CONTENT = 204;
  1211 +const HTTP_RESET_CONTENT = 205;
  1212 +const HTTP_PARTIAL_CONTENT = 206;
  1213 +const HTTP_MULTI_STATUS = 207; const HTTP_ALREADY_REPORTED = 208; const HTTP_IM_USED = 226; const HTTP_MULTIPLE_CHOICES = 300;
  1214 +const HTTP_MOVED_PERMANENTLY = 301;
  1215 +const HTTP_FOUND = 302;
  1216 +const HTTP_SEE_OTHER = 303;
  1217 +const HTTP_NOT_MODIFIED = 304;
  1218 +const HTTP_USE_PROXY = 305;
  1219 +const HTTP_RESERVED = 306;
  1220 +const HTTP_TEMPORARY_REDIRECT = 307;
  1221 +const HTTP_PERMANENTLY_REDIRECT = 308; const HTTP_BAD_REQUEST = 400;
  1222 +const HTTP_UNAUTHORIZED = 401;
  1223 +const HTTP_PAYMENT_REQUIRED = 402;
  1224 +const HTTP_FORBIDDEN = 403;
  1225 +const HTTP_NOT_FOUND = 404;
  1226 +const HTTP_METHOD_NOT_ALLOWED = 405;
  1227 +const HTTP_NOT_ACCEPTABLE = 406;
  1228 +const HTTP_PROXY_AUTHENTICATION_REQUIRED = 407;
  1229 +const HTTP_REQUEST_TIMEOUT = 408;
  1230 +const HTTP_CONFLICT = 409;
  1231 +const HTTP_GONE = 410;
  1232 +const HTTP_LENGTH_REQUIRED = 411;
  1233 +const HTTP_PRECONDITION_FAILED = 412;
  1234 +const HTTP_REQUEST_ENTITY_TOO_LARGE = 413;
  1235 +const HTTP_REQUEST_URI_TOO_LONG = 414;
  1236 +const HTTP_UNSUPPORTED_MEDIA_TYPE = 415;
  1237 +const HTTP_REQUESTED_RANGE_NOT_SATISFIABLE = 416;
  1238 +const HTTP_EXPECTATION_FAILED = 417;
  1239 +const HTTP_I_AM_A_TEAPOT = 418; const HTTP_UNPROCESSABLE_ENTITY = 422; const HTTP_LOCKED = 423; const HTTP_FAILED_DEPENDENCY = 424; const HTTP_RESERVED_FOR_WEBDAV_ADVANCED_COLLECTIONS_EXPIRED_PROPOSAL = 425; const HTTP_UPGRADE_REQUIRED = 426; const HTTP_PRECONDITION_REQUIRED = 428; const HTTP_TOO_MANY_REQUESTS = 429; const HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE = 431; const HTTP_INTERNAL_SERVER_ERROR = 500;
  1240 +const HTTP_NOT_IMPLEMENTED = 501;
  1241 +const HTTP_BAD_GATEWAY = 502;
  1242 +const HTTP_SERVICE_UNAVAILABLE = 503;
  1243 +const HTTP_GATEWAY_TIMEOUT = 504;
  1244 +const HTTP_VERSION_NOT_SUPPORTED = 505;
  1245 +const HTTP_VARIANT_ALSO_NEGOTIATES_EXPERIMENTAL = 506; const HTTP_INSUFFICIENT_STORAGE = 507; const HTTP_LOOP_DETECTED = 508; const HTTP_NOT_EXTENDED = 510; const HTTP_NETWORK_AUTHENTICATION_REQUIRED = 511;
1170 1246 public $headers;
1171 1247 protected $content;
1172 1248 protected $version;
... ... @@ -1246,7 +1322,9 @@ public function prepare(Request $request)
1246 1322 $headers = $this->headers;
1247 1323 if ($this->isInformational() || in_array($this->statusCode, array(204, 304))) {
1248 1324 $this->setContent(null);
1249   -}
  1325 +$headers->remove('Content-Type');
  1326 +$headers->remove('Content-Length');
  1327 +} else {
1250 1328 if (!$headers->has('Content-Type')) {
1251 1329 $format = $request->getRequestFormat();
1252 1330 if (null !== $format && $mimeType = $request->getMimeType($format)) {
... ... @@ -1255,9 +1333,9 @@ $headers->set('Content-Type', $mimeType);
1255 1333 }
1256 1334 $charset = $this->charset ?:'UTF-8';
1257 1335 if (!$headers->has('Content-Type')) {
1258   -$headers->set('Content-Type','text/html; charset='.$charset);
  1336 +$headers->set('Content-Type','text/html; charset='. $charset);
1259 1337 } elseif (0 === stripos($headers->get('Content-Type'),'text/') && false === stripos($headers->get('Content-Type'),'charset')) {
1260   -$headers->set('Content-Type', $headers->get('Content-Type').'; charset='.$charset);
  1338 +$headers->set('Content-Type', $headers->get('Content-Type') .'; charset='. $charset);
1261 1339 }
1262 1340 if ($headers->has('Transfer-Encoding')) {
1263 1341 $headers->remove('Content-Length');
... ... @@ -1269,6 +1347,7 @@ if ($length) {
1269 1347 $headers->set('Content-Length', $length);
1270 1348 }
1271 1349 }
  1350 +}
1272 1351 if ('HTTP/1.0'!= $request->server->get('SERVER_PROTOCOL')) {
1273 1352 $this->setProtocolVersion('1.1');
1274 1353 }
... ... @@ -1284,10 +1363,10 @@ public function sendHeaders()
1284 1363 if (headers_sent()) {
1285 1364 return $this;
1286 1365 }
1287   -header(sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText));
  1366 +header(sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText), true, $this->statusCode);
1288 1367 foreach ($this->headers->allPreserveCase() as $name => $values) {
1289 1368 foreach ($values as $value) {
1290   -header($name.': '.$value, false);
  1369 +header($name.': '.$value, false, $this->statusCode);
1291 1370 }
1292 1371 }
1293 1372 foreach ($this->headers->getCookies() as $cookie) {
... ... @@ -1307,22 +1386,7 @@ $this->sendContent();
1307 1386 if (function_exists('fastcgi_finish_request')) {
1308 1387 fastcgi_finish_request();
1309 1388 } elseif ('cli'!== PHP_SAPI) {
1310   -$previous = null;
1311   -$obStatus = ob_get_status(1);
1312   -while (($level = ob_get_level()) > 0 && $level !== $previous) {
1313   -$previous = $level;
1314   -if ($obStatus[$level - 1]) {
1315   -if (version_compare(PHP_VERSION,'5.4','>=')) {
1316   -if (isset($obStatus[$level - 1]['flags']) && ($obStatus[$level - 1]['flags'] & PHP_OUTPUT_HANDLER_REMOVABLE)) {
1317   -ob_end_flush();
1318   -}
1319   -} else {
1320   -if (isset($obStatus[$level - 1]['del']) && $obStatus[$level - 1]['del']) {
1321   -ob_end_flush();
1322   -}
1323   -}
1324   -}
1325   -}
  1389 +static::closeOutputBuffers(0, true);
1326 1390 flush();
1327 1391 }
1328 1392 return $this;
... ... @@ -1466,7 +1530,6 @@ return (int) $this->headers->getCacheControlDirective('max-age');
1466 1530 if (null !== $this->getExpires()) {
1467 1531 return $this->getExpires()->format('U') - $this->getDate()->format('U');
1468 1532 }
1469   -return null;
1470 1533 }
1471 1534 public function setMaxAge($value)
1472 1535 {
... ... @@ -1484,7 +1547,6 @@ public function getTtl()
1484 1547 if (null !== $maxAge = $this->getMaxAge()) {
1485 1548 return $maxAge - $this->getAge();
1486 1549 }
1487   -return null;
1488 1550 }
1489 1551 public function setTtl($seconds)
1490 1552 {
... ... @@ -1575,10 +1637,14 @@ return null !== $this->headers->get('Vary');
1575 1637 }
1576 1638 public function getVary()
1577 1639 {
1578   -if (!$vary = $this->headers->get('Vary')) {
  1640 +if (!$vary = $this->headers->get('Vary', null, false)) {
1579 1641 return array();
1580 1642 }
1581   -return is_array($vary) ? $vary : preg_split('/[\s,]+/', $vary);
  1643 +$ret = array();
  1644 +foreach ($vary as $item) {
  1645 +$ret = array_merge($ret, preg_split('/[\s,]+/', $item));
  1646 +}
  1647 +return $ret;
1582 1648 }
1583 1649 public function setVary($headers, $replace = true)
1584 1650 {
... ... @@ -1644,7 +1710,26 @@ return in_array($this->statusCode, array(201, 301, 302, 303, 307, 308)) && (null
1644 1710 }
1645 1711 public function isEmpty()
1646 1712 {
1647   -return in_array($this->statusCode, array(201, 204, 304));
  1713 +return in_array($this->statusCode, array(204, 304));
  1714 +}
  1715 +public static function closeOutputBuffers($targetLevel, $flush)
  1716 +{
  1717 +$status = ob_get_status(true);
  1718 +$level = count($status);
  1719 +while ($level-- > $targetLevel
  1720 +&& (!empty($status[$level]['del'])
  1721 +|| (isset($status[$level]['flags'])
  1722 +&& ($status[$level]['flags'] & PHP_OUTPUT_HANDLER_REMOVABLE)
  1723 +&& ($status[$level]['flags'] & ($flush ? PHP_OUTPUT_HANDLER_FLUSHABLE : PHP_OUTPUT_HANDLER_CLEANABLE))
  1724 +)
  1725 +)
  1726 +) {
  1727 +if ($flush) {
  1728 +ob_end_flush();
  1729 +} else {
  1730 +ob_end_clean();
  1731 +}
  1732 +}
1648 1733 }
1649 1734 protected function ensureIEOverSSLCompatibility(Request $request)
1650 1735 {
... ... @@ -1857,23 +1942,17 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
1857 1942 class Container implements IntrospectableContainerInterface
1858 1943 {
1859 1944 protected $parameterBag;
1860   -protected $services;
1861   -protected $methodMap;
1862   -protected $aliases;
1863   -protected $scopes;
1864   -protected $scopeChildren;
1865   -protected $scopedServices;
1866   -protected $scopeStacks;
  1945 +protected $services = array();
  1946 +protected $methodMap = array();
  1947 +protected $aliases = array();
  1948 +protected $scopes = array();
  1949 +protected $scopeChildren = array();
  1950 +protected $scopedServices = array();
  1951 +protected $scopeStacks = array();
1867 1952 protected $loading = array();
1868 1953 public function __construct(ParameterBagInterface $parameterBag = null)
1869 1954 {
1870   -$this->parameterBag = null === $parameterBag ? new ParameterBag() : $parameterBag;
1871   -$this->services = array();
1872   -$this->aliases = array();
1873   -$this->scopes = array();
1874   -$this->scopeChildren = array();
1875   -$this->scopedServices = array();
1876   -$this->scopeStacks = array();
  1955 +$this->parameterBag = $parameterBag ?: new ParameterBag();
1877 1956 $this->set('service_container', $this);
1878 1957 }
1879 1958 public function compile()
... ... @@ -1907,6 +1986,9 @@ if (self::SCOPE_PROTOTYPE === $scope) {
1907 1986 throw new InvalidArgumentException(sprintf('You cannot set service "%s" of scope "prototype".', $id));
1908 1987 }
1909 1988 $id = strtolower($id);
  1989 +if ('service_container'=== $id) {
  1990 +return;
  1991 +}
1910 1992 if (self::SCOPE_CONTAINER !== $scope) {
1911 1993 if (!isset($this->scopedServices[$scope])) {
1912 1994 throw new RuntimeException(sprintf('You cannot set service "%s" of inactive scope.', $id));
... ... @@ -1927,6 +2009,9 @@ unset($this->services[$id]);
1927 2009 public function has($id)
1928 2010 {
1929 2011 $id = strtolower($id);
  2012 +if ('service_container'=== $id) {
  2013 +return true;
  2014 +}
1930 2015 return isset($this->services[$id])
1931 2016 || array_key_exists($id, $this->services)
1932 2017 || isset($this->aliases[$id])
... ... @@ -1939,6 +2024,9 @@ foreach (array(false, true) as $strtolower) {
1939 2024 if ($strtolower) {
1940 2025 $id = strtolower($id);
1941 2026 }
  2027 +if ('service_container'=== $id) {
  2028 +return $this;
  2029 +}
1942 2030 if (isset($this->aliases[$id])) {
1943 2031 $id = $this->aliases[$id];
1944 2032 }
... ... @@ -1966,7 +2054,7 @@ $alternatives[] = $key;
1966 2054 }
1967 2055 throw new ServiceNotFoundException($id, null, null, $alternatives);
1968 2056 }
1969   -return null;
  2057 +return;
1970 2058 }
1971 2059 $this->loading[$id] = true;
1972 2060 try {
... ... @@ -1977,7 +2065,7 @@ if (array_key_exists($id, $this->services)) {
1977 2065 unset($this->services[$id]);
1978 2066 }
1979 2067 if ($e instanceof InactiveScopeException && self::EXCEPTION_ON_INVALID_REFERENCE !== $invalidBehavior) {
1980   -return null;
  2068 +return;
1981 2069 }
1982 2070 throw $e;
1983 2071 }
... ... @@ -1987,6 +2075,9 @@ return $service;
1987 2075 public function initialized($id)
1988 2076 {
1989 2077 $id = strtolower($id);
  2078 +if ('service_container'=== $id) {
  2079 +return true;
  2080 +}
1990 2081 return isset($this->services[$id]) || array_key_exists($id, $this->services);
1991 2082 }
1992 2083 public function getServiceIds()
... ... @@ -1998,6 +2089,7 @@ if (preg_match('/^get(.+)Service$/', $method->name, $match)) {
1998 2089 $ids[] = self::underscore($match[1]);
1999 2090 }
2000 2091 }
  2092 +$ids[] ='service_container';
2001 2093 return array_unique(array_merge($ids, array_keys($this->services)));
2002 2094 }
2003 2095 public function enterScope($name)
... ... @@ -2160,30 +2252,28 @@ use Symfony\Component\Config\ConfigCache;
2160 2252 use Symfony\Component\ClassLoader\ClassCollectionLoader;
2161 2253 abstract class Kernel implements KernelInterface, TerminableInterface
2162 2254 {
2163   -protected $bundles;
  2255 +protected $bundles = array();
2164 2256 protected $bundleMap;
2165 2257 protected $container;
2166 2258 protected $rootDir;
2167 2259 protected $environment;
2168 2260 protected $debug;
2169   -protected $booted;
  2261 +protected $booted = false;
2170 2262 protected $name;
2171 2263 protected $startTime;
2172 2264 protected $loadClassCache;
2173   -const VERSION ='2.3.10';
2174   -const VERSION_ID ='20310';
  2265 +const VERSION ='2.5.4';
  2266 +const VERSION_ID ='20504';
2175 2267 const MAJOR_VERSION ='2';
2176   -const MINOR_VERSION ='3';
2177   -const RELEASE_VERSION ='10';
  2268 +const MINOR_VERSION ='5';
  2269 +const RELEASE_VERSION ='4';
2178 2270 const EXTRA_VERSION ='';
2179 2271 public function __construct($environment, $debug)
2180 2272 {
2181 2273 $this->environment = $environment;
2182   -$this->debug = (Boolean) $debug;
2183   -$this->booted = false;
  2274 +$this->debug = (bool) $debug;
2184 2275 $this->rootDir = $this->getRootDir();
2185 2276 $this->name = $this->getName();
2186   -$this->bundles = array();
2187 2277 if ($this->debug) {
2188 2278 $this->startTime = microtime(true);
2189 2279 }
... ... @@ -2540,21 +2630,33 @@ return $source;
2540 2630 $rawChunk ='';
2541 2631 $output ='';
2542 2632 $tokens = token_get_all($source);
  2633 +$ignoreSpace = false;
2543 2634 for (reset($tokens); false !== $token = current($tokens); next($tokens)) {
2544 2635 if (is_string($token)) {
2545 2636 $rawChunk .= $token;
2546 2637 } elseif (T_START_HEREDOC === $token[0]) {
2547   -$output .= preg_replace(array('/\s+$/Sm','/\n+/S'),"\n", $rawChunk).$token[1];
  2638 +$output .= $rawChunk.$token[1];
2548 2639 do {
2549 2640 $token = next($tokens);
2550 2641 $output .= $token[1];
2551 2642 } while ($token[0] !== T_END_HEREDOC);
2552 2643 $rawChunk ='';
2553   -} elseif (!in_array($token[0], array(T_COMMENT, T_DOC_COMMENT))) {
  2644 +} elseif (T_WHITESPACE === $token[0]) {
  2645 +if ($ignoreSpace) {
  2646 +$ignoreSpace = false;
  2647 +continue;
  2648 +}
  2649 +$rawChunk .= preg_replace(array('/\n{2,}/S'),"\n", $token[1]);
  2650 +} elseif (in_array($token[0], array(T_COMMENT, T_DOC_COMMENT))) {
  2651 +$ignoreSpace = true;
  2652 +} else {
2554 2653 $rawChunk .= $token[1];
  2654 +if (T_OPEN_TAG === $token[0]) {
  2655 +$ignoreSpace = true;
2555 2656 }
2556 2657 }
2557   -$output .= preg_replace(array('/\s+$/Sm','/\n+/S'),"\n", $rawChunk);
  2658 +}
  2659 +$output .= $rawChunk;
2558 2660 return $output;
2559 2661 }
2560 2662 public function serialize()
... ... @@ -2652,8 +2754,8 @@ use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
2652 2754 abstract class Bundle extends ContainerAware implements BundleInterface
2653 2755 {
2654 2756 protected $name;
2655   -protected $reflected;
2656 2757 protected $extension;
  2758 +protected $path;
2657 2759 public function boot()
2658 2760 {
2659 2761 }
... ... @@ -2687,21 +2789,19 @@ return $this->extension;
2687 2789 }
2688 2790 public function getNamespace()
2689 2791 {
2690   -if (null === $this->reflected) {
2691   -$this->reflected = new \ReflectionObject($this);
2692   -}
2693   -return $this->reflected->getNamespaceName();
  2792 +$class = get_class($this);
  2793 +return substr($class, 0, strrpos($class,'\\'));
2694 2794 }
2695 2795 public function getPath()
2696 2796 {
2697   -if (null === $this->reflected) {
2698   -$this->reflected = new \ReflectionObject($this);
  2797 +if (null === $this->path) {
  2798 +$reflected = new \ReflectionObject($this);
  2799 +$this->path = dirname($reflected->getFileName());
2699 2800 }
2700   -return dirname($this->reflected->getFileName());
  2801 +return $this->path;
2701 2802 }
2702 2803 public function getParent()
2703 2804 {
2704   -return null;
2705 2805 }
2706 2806 final public function getName()
2707 2807 {
... ... @@ -2725,7 +2825,14 @@ $ns = $prefix;
2725 2825 if ($relativePath = $file->getRelativePath()) {
2726 2826 $ns .='\\'.strtr($relativePath,'/','\\');
2727 2827 }
2728   -$r = new \ReflectionClass($ns.'\\'.$file->getBasename('.php'));
  2828 +$class = $ns.'\\'.$file->getBasename('.php');
  2829 +if ($this->container) {
  2830 +$alias ='console.command.'.strtolower(str_replace('\\','_', $class));
  2831 +if ($this->container->has($alias)) {
  2832 +continue;
  2833 +}
  2834 +}
  2835 +$r = new \ReflectionClass($class);
2729 2836 if ($r->isSubclassOf('Symfony\\Component\\Console\\Command\\Command') && !$r->isAbstract() && !$r->getConstructor()->getNumberOfRequiredParameters()) {
2730 2837 $application->add($r->newInstance());
2731 2838 }
... ... @@ -2736,6 +2843,7 @@ $application->add($r->newInstance());
2736 2843 namespace Symfony\Component\Config
2737 2844 {
2738 2845 use Symfony\Component\Config\Resource\ResourceInterface;
  2846 +use Symfony\Component\Filesystem\Exception\IOException;
2739 2847 use Symfony\Component\Filesystem\Filesystem;
2740 2848 class ConfigCache
2741 2849 {
... ... @@ -2744,7 +2852,7 @@ private $file;
2744 2852 public function __construct($file, $debug)
2745 2853 {
2746 2854 $this->file = $file;
2747   -$this->debug = (Boolean) $debug;
  2855 +$this->debug = (bool) $debug;
2748 2856 }
2749 2857 public function __toString()
2750 2858 {
... ... @@ -2773,11 +2881,20 @@ return true;
2773 2881 }
2774 2882 public function write($content, array $metadata = null)
2775 2883 {
2776   -$mode = 0666 & ~umask();
  2884 +$mode = 0666;
  2885 +$umask = umask();
2777 2886 $filesystem = new Filesystem();
2778   -$filesystem->dumpFile($this->file, $content, $mode);
  2887 +$filesystem->dumpFile($this->file, $content, null);
  2888 +try {
  2889 +$filesystem->chmod($this->file, $mode, $umask);
  2890 +} catch (IOException $e) {
  2891 +}
2779 2892 if (null !== $metadata && true === $this->debug) {
2780   -$filesystem->dumpFile($this->getMetaFile(), serialize($metadata), $mode);
  2893 +$filesystem->dumpFile($this->getMetaFile(), serialize($metadata), null);
  2894 +try {
  2895 +$filesystem->chmod($this->getMetaFile(), $mode, $umask);
  2896 +} catch (IOException $e) {
  2897 +}
2781 2898 }
2782 2899 }
2783 2900 private function getMetaFile()
... ... @@ -2793,21 +2910,25 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
2793 2910 use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
2794 2911 use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
2795 2912 use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
  2913 +use Symfony\Component\HttpKernel\Event\FinishRequestEvent;
2796 2914 use Symfony\Component\HttpKernel\Event\GetResponseEvent;
2797 2915 use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent;
2798 2916 use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
2799 2917 use Symfony\Component\HttpKernel\Event\PostResponseEvent;
2800 2918 use Symfony\Component\HttpFoundation\Request;
  2919 +use Symfony\Component\HttpFoundation\RequestStack;
2801 2920 use Symfony\Component\HttpFoundation\Response;
2802 2921 use Symfony\Component\EventDispatcher\EventDispatcherInterface;
2803 2922 class HttpKernel implements HttpKernelInterface, TerminableInterface
2804 2923 {
2805 2924 protected $dispatcher;
2806 2925 protected $resolver;
2807   -public function __construct(EventDispatcherInterface $dispatcher, ControllerResolverInterface $resolver)
  2926 +protected $requestStack;
  2927 +public function __construct(EventDispatcherInterface $dispatcher, ControllerResolverInterface $resolver, RequestStack $requestStack = null)
2808 2928 {
2809 2929 $this->dispatcher = $dispatcher;
2810 2930 $this->resolver = $resolver;
  2931 +$this->requestStack = $requestStack ?: new RequestStack();
2811 2932 }
2812 2933 public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
2813 2934 {
... ... @@ -2815,6 +2936,7 @@ try {
2815 2936 return $this->handleRaw($request, $type);
2816 2937 } catch (\Exception $e) {
2817 2938 if (false === $catch) {
  2939 +$this->finishRequest($request, $type);
2818 2940 throw $e;
2819 2941 }
2820 2942 return $this->handleException($e, $request, $type);
... ... @@ -2824,8 +2946,19 @@ public function terminate(Request $request, Response $response)
2824 2946 {
2825 2947 $this->dispatcher->dispatch(KernelEvents::TERMINATE, new PostResponseEvent($this, $request, $response));
2826 2948 }
  2949 +public function terminateWithException(\Exception $exception)
  2950 +{
  2951 +if (!$request = $this->requestStack->getMasterRequest()) {
  2952 +throw new \LogicException('Request stack is empty', 0, $exception);
  2953 +}
  2954 +$response = $this->handleException($exception, $request, self::MASTER_REQUEST);
  2955 +$response->sendHeaders();
  2956 +$response->sendContent();
  2957 +$this->terminate($request, $response);
  2958 +}
2827 2959 private function handleRaw(Request $request, $type = self::MASTER_REQUEST)
2828 2960 {
  2961 +$this->requestStack->push($request);
2829 2962 $event = new GetResponseEvent($this, $request, $type);
2830 2963 $this->dispatcher->dispatch(KernelEvents::REQUEST, $event);
2831 2964 if ($event->hasResponse()) {
... ... @@ -2859,14 +2992,21 @@ private function filterResponse(Response $response, Request $request, $type)
2859 2992 {
2860 2993 $event = new FilterResponseEvent($this, $request, $type, $response);
2861 2994 $this->dispatcher->dispatch(KernelEvents::RESPONSE, $event);
  2995 +$this->finishRequest($request, $type);
2862 2996 return $event->getResponse();
2863 2997 }
  2998 +private function finishRequest(Request $request, $type)
  2999 +{
  3000 +$this->dispatcher->dispatch(KernelEvents::FINISH_REQUEST, new FinishRequestEvent($this, $request, $type));
  3001 +$this->requestStack->pop();
  3002 +}
2864 3003 private function handleException(\Exception $e, $request, $type)
2865 3004 {
2866 3005 $event = new GetResponseForExceptionEvent($this, $request, $type, $e);
2867 3006 $this->dispatcher->dispatch(KernelEvents::EXCEPTION, $event);
2868 3007 $e = $event->getException();
2869 3008 if (!$event->hasResponse()) {
  3009 +$this->finishRequest($request, $type);
2870 3010 throw $e;
2871 3011 }
2872 3012 $response = $event->getResponse();
... ... @@ -2918,6 +3058,7 @@ return (string) $var;
2918 3058 namespace Symfony\Component\HttpKernel\DependencyInjection
2919 3059 {
2920 3060 use Symfony\Component\HttpFoundation\Request;
  3061 +use Symfony\Component\HttpFoundation\RequestStack;
2921 3062 use Symfony\Component\HttpKernel\HttpKernelInterface;
2922 3063 use Symfony\Component\HttpKernel\HttpKernel;
2923 3064 use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface;
... ... @@ -2927,9 +3068,9 @@ use Symfony\Component\DependencyInjection\Scope;
2927 3068 class ContainerAwareHttpKernel extends HttpKernel
2928 3069 {
2929 3070 protected $container;
2930   -public function __construct(EventDispatcherInterface $dispatcher, ContainerInterface $container, ControllerResolverInterface $controllerResolver)
  3071 +public function __construct(EventDispatcherInterface $dispatcher, ContainerInterface $container, ControllerResolverInterface $controllerResolver, RequestStack $requestStack = null)
2931 3072 {
2932   -parent::__construct($dispatcher, $controllerResolver);
  3073 +parent::__construct($dispatcher, $controllerResolver, $requestStack);
2933 3074 $this->container = $container;
2934 3075 if (!$container->hasScope('request')) {
2935 3076 $container->addScope(new Scope('request'));
... ...
app/config/config.yml
... ... @@ -14,8 +14,8 @@ framework:
14 14 validation: { enable_annotations: true }
15 15 templating: { engines: ['twig'] } #assets_version: SomeVersionScheme
16 16 default_locale: "%locale%"
17   -# trusted_proxies: ~
18 17 session: ~
  18 +# trusted_proxies: ~
19 19 # session:
20 20 # handler_id: session.handler.pdo
21 21  
... ... @@ -26,6 +26,7 @@ parameters:
26 26 db_data_col: session_value
27 27 db_time_col: session_time
28 28  
  29 +
29 30 # Twig Configuration
30 31 twig:
31 32 debug: "%kernel.debug%"
... ... @@ -167,14 +168,14 @@ jms_translation:
167 168 dirs: [%kernel.root_dir%, %kernel.root_dir%/../app]
168 169 output_dir: %kernel.root_dir%/Resources/translations
169 170 ignored_domains: [routes]
170   - excluded_names: [*TestCase.php, *Test.php]
  171 + excluded_names: ["*TestCase.php", "*Test.php"]
171 172 excluded_dirs: [cache, data, logs]
172 173 #extractors: [alias_of_the_extractor]
173 174 src:
174 175 dirs: [%kernel.root_dir%, %kernel.root_dir%/../src]
175 176 output_dir: %kernel.root_dir%/../src/Cacic/CommonBundle/Resources/translations
176 177 ignored_domains: [routes]
177   - excluded_names: [*TestCase.php, *Test.php]
  178 + excluded_names: ["*TestCase.php", "*Test.php"]
178 179 excluded_dirs: [Common, Entity, Form]
179 180 #extractors: [alias_of_the_extractor]
180 181  
... ... @@ -211,3 +212,8 @@ services:
211 212 session.handler.pdo:
212 213 class: Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler
213 214 arguments: ["@pdo", "%pdo.db_options%"]
  215 +
  216 + apikey_authenticator:
  217 + class: Cacic\WSBundle\Security\ApiKeyAuthenticator
  218 + arguments: ["@webservice_user_provider"]
  219 +
... ...
app/config/security.yml
... ... @@ -16,11 +16,20 @@ security:
16 16 providers:
17 17 main:
18 18 entity: { class: Cacic\CommonBundle\Entity\Usuario, property: nmUsuarioAcesso }
  19 + webservice:
  20 + id: webservice_user_provider
19 21  
20 22 firewalls:
21 23 dev:
22 24 pattern: ^/(_(profiler|wdt)|css|images|js|assets|assetic)/
23 25 security: false
  26 +
  27 + ws_neo:
  28 + pattern: ^/ws/neo/getLogin
  29 + stateless: false
  30 + simple_preauth:
  31 + authenticator: apikey_authenticator
  32 +
24 33 login:
25 34 pattern: ^/login$
26 35 security: false
... ...
composer.json
... ... @@ -24,20 +24,20 @@
24 24 ],
25 25 "require": {
26 26 "php": ">=5.3.3",
27   - "symfony/symfony": "2.3.10",
  27 + "symfony/symfony": "~2.5",
28 28 "jquery/jquery": "1.10.*",
29   - "doctrine/orm": ">=2.2.3,<2.4-dev",
  29 + "doctrine/orm": "~2.4",
30 30 "doctrine/doctrine-bundle": "1.2.*",
31   - "twig/extensions": "1.0.*",
32   - "symfony/assetic-bundle": "2.3.*",
33   - "symfony/swiftmailer-bundle": "2.3.*",
34   - "symfony/monolog-bundle": "2.3.*",
35   - "sensio/distribution-bundle": "2.3.*",
36   - "sensio/framework-extra-bundle": "2.3.*",
37   - "sensio/generator-bundle": "2.3.*",
  31 + "twig/extensions": "~1.1",
  32 + "symfony/assetic-bundle": "~2.3",
  33 + "symfony/swiftmailer-bundle": "~2.3",
  34 + "symfony/monolog-bundle": "~2.6",
  35 + "sensio/distribution-bundle": "~2.3",
  36 + "sensio/framework-extra-bundle": "~2.3",
  37 + "sensio/generator-bundle": "~2.4",
38 38 "incenteev/composer-parameter-handler": "~2.0",
39   - "symfony/finder": "2.3.*",
40   - "jms/security-extra-bundle": "1.5.*",
  39 + "symfony/finder": "~2.3",
  40 + "jms/security-extra-bundle": "~1.5",
41 41 "jms/di-extra-bundle": "1.4.*",
42 42 "kriswallsmith/assetic": "v1.1.1",
43 43 "braincrafted/bootstrap-bundle": "~2.0",
... ... @@ -48,10 +48,10 @@
48 48 "ijanki/ftp-bundle": "*",
49 49 "jms/translation-bundle": "1.1.*@dev",
50 50 "helios-ag/fm-elfinder-bundle": "1.x",
51   - "knplabs/knp-menu": "2.0.0-alpha1",
52   - "knplabs/knp-menu-bundle": "2.0.0-alpha1",
  51 + "knplabs/knp-menu": "~2.0",
  52 + "knplabs/knp-menu-bundle": "~2.0",
53 53 "jpgraph/jpgraph": "dev-master",
54   - "symfony/class-loader": "2.2.*",
  54 + "symfony/class-loader": "~2.3",
55 55 "friendsofsymfony/rest-bundle": "dev-master",
56 56 "jms/serializer": "0.14.*@dev",
57 57 "jms/serializer-bundle": "0.13.*@dev",
... ...
composer.lock
... ... @@ -4,21 +4,21 @@
4 4 "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
5 5 "This file is @generated automatically"
6 6 ],
7   - "hash": "4ce2775488ee172a7deb32d74d4dbf59",
  7 + "hash": "c5bdcf452360fdac257f1b3f2477a9f1",
8 8 "packages": [
9 9 {
10 10 "name": "braincrafted/bootstrap-bundle",
11   - "version": "v2.0.1",
  11 + "version": "v2.1.0",
12 12 "target-dir": "Braincrafted/Bundle/BootstrapBundle",
13 13 "source": {
14 14 "type": "git",
15 15 "url": "https://github.com/braincrafted/bootstrap-bundle.git",
16   - "reference": "dc6169b1e29d8668cda960aa663fcc4bbd602bd4"
  16 + "reference": "56231594bfce2b4fd293592662f508becc4c494e"
17 17 },
18 18 "dist": {
19 19 "type": "zip",
20   - "url": "https://api.github.com/repos/braincrafted/bootstrap-bundle/zipball/dc6169b1e29d8668cda960aa663fcc4bbd602bd4",
21   - "reference": "dc6169b1e29d8668cda960aa663fcc4bbd602bd4",
  20 + "url": "https://api.github.com/repos/braincrafted/bootstrap-bundle/zipball/56231594bfce2b4fd293592662f508becc4c494e",
  21 + "reference": "56231594bfce2b4fd293592662f508becc4c494e",
22 22 "shasum": ""
23 23 },
24 24 "require": {
... ... @@ -57,15 +57,14 @@
57 57 {
58 58 "name": "Florian Eckerstorfer",
59 59 "email": "florian@eckerstorfer.co",
60   - "homepage": "http://florian.ec",
61   - "role": "Developer"
  60 + "homepage": "http://florian.ec"
62 61 }
63 62 ],
64 63 "description": "BraincraftedBootstrapBundle integrates Bootstrap into Symfony2 by providing templates, Twig extensions, services and commands.",
65 64 "keywords": [
66 65 "bootstrap"
67 66 ],
68   - "time": "2014-04-03 16:59:23"
  67 + "time": "2014-08-31 10:47:30"
69 68 },
70 69 {
71 70 "name": "ddeboer/data-import",
... ... @@ -256,16 +255,16 @@
256 255 },
257 256 {
258 257 "name": "doctrine/cache",
259   - "version": "v1.3.0",
  258 + "version": "v1.3.1",
260 259 "source": {
261 260 "type": "git",
262 261 "url": "https://github.com/doctrine/cache.git",
263   - "reference": "e16d7adf45664a50fa86f515b6d5e7f670130449"
  262 + "reference": "cf483685798a72c93bf4206e3dd6358ea07d64e7"
264 263 },
265 264 "dist": {
266 265 "type": "zip",
267   - "url": "https://api.github.com/repos/doctrine/cache/zipball/e16d7adf45664a50fa86f515b6d5e7f670130449",
268   - "reference": "e16d7adf45664a50fa86f515b6d5e7f670130449",
  266 + "url": "https://api.github.com/repos/doctrine/cache/zipball/cf483685798a72c93bf4206e3dd6358ea07d64e7",
  267 + "reference": "cf483685798a72c93bf4206e3dd6358ea07d64e7",
269 268 "shasum": ""
270 269 },
271 270 "require": {
... ... @@ -281,7 +280,7 @@
281 280 "type": "library",
282 281 "extra": {
283 282 "branch-alias": {
284   - "dev-master": "1.0.x-dev"
  283 + "dev-master": "1.4.x-dev"
285 284 }
286 285 },
287 286 "autoload": {
... ... @@ -295,17 +294,6 @@
295 294 ],
296 295 "authors": [
297 296 {
298   - "name": "Jonathan Wage",
299   - "email": "jonwage@gmail.com",
300   - "homepage": "http://www.jwage.com/",
301   - "role": "Creator"
302   - },
303   - {
304   - "name": "Guilherme Blanco",
305   - "email": "guilhermeblanco@gmail.com",
306   - "homepage": "http://www.instaclick.com"
307   - },
308   - {
309 297 "name": "Roman Borschel",
310 298 "email": "roman@code-factory.org"
311 299 },
... ... @@ -314,10 +302,16 @@
314 302 "email": "kontakt@beberlei.de"
315 303 },
316 304 {
317   - "name": "Johannes M. Schmitt",
318   - "email": "schmittjoh@gmail.com",
319   - "homepage": "https://github.com/schmittjoh",
320   - "role": "Developer of wrapped JMSSerializerBundle"
  305 + "name": "Guilherme Blanco",
  306 + "email": "guilhermeblanco@gmail.com"
  307 + },
  308 + {
  309 + "name": "Jonathan Wage",
  310 + "email": "jonwage@gmail.com"
  311 + },
  312 + {
  313 + "name": "Johannes Schmitt",
  314 + "email": "schmittjoh@gmail.com"
321 315 }
322 316 ],
323 317 "description": "Caching library offering an object-oriented API for many cache backends",
... ... @@ -326,7 +320,7 @@
326 320 "cache",
327 321 "caching"
328 322 ],
329   - "time": "2013-10-25 19:04:14"
  323 + "time": "2014-09-17 14:24:04"
330 324 },
331 325 {
332 326 "name": "doctrine/collections",
... ... @@ -480,12 +474,12 @@
480 474 "source": {
481 475 "type": "git",
482 476 "url": "https://github.com/doctrine/data-fixtures.git",
483   - "reference": "e847b073c2b5350045edbb40443645ad09a59538"
  477 + "reference": "ac36ccc812454e057aec564e0725509e74ce6b35"
484 478 },
485 479 "dist": {
486 480 "type": "zip",
487   - "url": "https://api.github.com/repos/doctrine/data-fixtures/zipball/e847b073c2b5350045edbb40443645ad09a59538",
488   - "reference": "e847b073c2b5350045edbb40443645ad09a59538",
  481 + "url": "https://api.github.com/repos/doctrine/data-fixtures/zipball/ac36ccc812454e057aec564e0725509e74ce6b35",
  482 + "reference": "ac36ccc812454e057aec564e0725509e74ce6b35",
489 483 "shasum": ""
490 484 },
491 485 "require": {
... ... @@ -518,9 +512,7 @@
518 512 "authors": [
519 513 {
520 514 "name": "Jonathan Wage",
521   - "email": "jonwage@gmail.com",
522   - "homepage": "http://www.jwage.com/",
523   - "role": "Creator"
  515 + "email": "jonwage@gmail.com"
524 516 }
525 517 ],
526 518 "description": "Data Fixtures for all Doctrine Object Managers",
... ... @@ -528,35 +520,37 @@
528 520 "keywords": [
529 521 "database"
530 522 ],
531   - "time": "2014-03-13 12:26:17"
  523 + "time": "2014-08-18 12:52:16"
532 524 },
533 525 {
534 526 "name": "doctrine/dbal",
535   - "version": "2.3.4",
  527 + "version": "v2.4.2",
536 528 "source": {
537 529 "type": "git",
538 530 "url": "https://github.com/doctrine/dbal.git",
539   - "reference": "2a37b007dda8e21bdbb8fa445be8fa0064199e13"
  531 + "reference": "fec965d330c958e175c39e61c3f6751955af32d0"
540 532 },
541 533 "dist": {
542 534 "type": "zip",
543   - "url": "https://api.github.com/repos/doctrine/dbal/zipball/2a37b007dda8e21bdbb8fa445be8fa0064199e13",
544   - "reference": "2a37b007dda8e21bdbb8fa445be8fa0064199e13",
  535 + "url": "https://api.github.com/repos/doctrine/dbal/zipball/fec965d330c958e175c39e61c3f6751955af32d0",
  536 + "reference": "fec965d330c958e175c39e61c3f6751955af32d0",
545 537 "shasum": ""
546 538 },
547 539 "require": {
548   - "doctrine/common": ">=2.3.0,<2.5-dev",
  540 + "doctrine/common": "~2.4",
549 541 "php": ">=5.3.2"
550 542 },
551   - "type": "library",
552   - "extra": {
553   - "branch-alias": {
554   - "dev-master": "2.3.x-dev"
555   - }
  543 + "require-dev": {
  544 + "phpunit/phpunit": "3.7.*",
  545 + "symfony/console": "~2.0"
  546 + },
  547 + "suggest": {
  548 + "symfony/console": "Allows use of the command line interface"
556 549 },
  550 + "type": "library",
557 551 "autoload": {
558 552 "psr-0": {
559   - "Doctrine\\DBAL": "lib/"
  553 + "Doctrine\\DBAL\\": "lib/"
560 554 }
561 555 },
562 556 "notification-url": "https://packagist.org/downloads/",
... ... @@ -592,7 +586,7 @@
592 586 "persistence",
593 587 "queryobject"
594 588 ],
595   - "time": "2013-05-11 07:45:37"
  589 + "time": "2014-01-01 16:43:57"
596 590 },
597 591 {
598 592 "name": "doctrine/doctrine-bundle",
... ... @@ -673,12 +667,12 @@
673 667 "source": {
674 668 "type": "git",
675 669 "url": "https://github.com/doctrine/DoctrineFixturesBundle.git",
676   - "reference": "ccd69d9ec90013955a412a21125672afc09738dc"
  670 + "reference": "9a5b5289eb22079ec139ba1eb06043d4b89c6677"
677 671 },
678 672 "dist": {
679 673 "type": "zip",
680   - "url": "https://api.github.com/repos/doctrine/DoctrineFixturesBundle/zipball/ccd69d9ec90013955a412a21125672afc09738dc",
681   - "reference": "ccd69d9ec90013955a412a21125672afc09738dc",
  674 + "url": "https://api.github.com/repos/doctrine/DoctrineFixturesBundle/zipball/9a5b5289eb22079ec139ba1eb06043d4b89c6677",
  675 + "reference": "9a5b5289eb22079ec139ba1eb06043d4b89c6677",
682 676 "shasum": ""
683 677 },
684 678 "require": {
... ... @@ -704,18 +698,16 @@
704 698 ],
705 699 "authors": [
706 700 {
707   - "name": "Fabien Potencier",
708   - "email": "fabien@symfony.com",
709   - "homepage": "http://fabien.potencier.org",
710   - "role": "Lead Developer"
711   - },
712   - {
713 701 "name": "Symfony Community",
714 702 "homepage": "http://symfony.com/contributors"
715 703 },
716 704 {
717 705 "name": "Doctrine Project",
718 706 "homepage": "http://www.doctrine-project.org"
  707 + },
  708 + {
  709 + "name": "Fabien Potencier",
  710 + "email": "fabien@symfony.com"
719 711 }
720 712 ],
721 713 "description": "Symfony DoctrineFixturesBundle",
... ... @@ -724,7 +716,7 @@
724 716 "Fixture",
725 717 "persistence"
726 718 ],
727   - "time": "2014-03-05 01:11:31"
  719 + "time": "2014-09-16 05:03:04"
728 720 },
729 721 {
730 722 "name": "doctrine/doctrine-migrations-bundle",
... ... @@ -733,12 +725,12 @@
733 725 "source": {
734 726 "type": "git",
735 727 "url": "https://github.com/doctrine/DoctrineMigrationsBundle.git",
736   - "reference": "f7138381aa884c0f679da4de41e369b94ead9cd3"
  728 + "reference": "81575a4316951125ce408c70f30547c77d98f78a"
737 729 },
738 730 "dist": {
739 731 "type": "zip",
740   - "url": "https://api.github.com/repos/doctrine/DoctrineMigrationsBundle/zipball/f7138381aa884c0f679da4de41e369b94ead9cd3",
741   - "reference": "f7138381aa884c0f679da4de41e369b94ead9cd3",
  732 + "url": "https://api.github.com/repos/doctrine/DoctrineMigrationsBundle/zipball/81575a4316951125ce408c70f30547c77d98f78a",
  733 + "reference": "81575a4316951125ce408c70f30547c77d98f78a",
742 734 "shasum": ""
743 735 },
744 736 "require": {
... ... @@ -764,18 +756,16 @@
764 756 ],
765 757 "authors": [
766 758 {
767   - "name": "Fabien Potencier",
768   - "email": "fabien@symfony.com",
769   - "homepage": "http://fabien.potencier.org",
770   - "role": "Lead Developer"
771   - },
772   - {
773 759 "name": "Symfony Community",
774 760 "homepage": "http://symfony.com/contributors"
775 761 },
776 762 {
777 763 "name": "Doctrine Project",
778 764 "homepage": "http://www.doctrine-project.org"
  765 + },
  766 + {
  767 + "name": "Fabien Potencier",
  768 + "email": "fabien@symfony.com"
779 769 }
780 770 ],
781 771 "description": "Symfony DoctrineMigrationsBundle",
... ... @@ -785,7 +775,7 @@
785 775 "migrations",
786 776 "schema"
787 777 ],
788   - "time": "2014-03-20 14:48:55"
  778 + "time": "2014-08-17 07:53:47"
789 779 },
790 780 {
791 781 "name": "doctrine/inflector",
... ... @@ -909,12 +899,12 @@
909 899 "source": {
910 900 "type": "git",
911 901 "url": "https://github.com/doctrine/migrations.git",
912   - "reference": "4256449c5e2603a6b6ee5a78c7c4521d4d4430b8"
  902 + "reference": "1a9dffa64e33fdc10f4b4c3f5d7230b74d4a1021"
913 903 },
914 904 "dist": {
915 905 "type": "zip",
916   - "url": "https://api.github.com/repos/doctrine/migrations/zipball/4256449c5e2603a6b6ee5a78c7c4521d4d4430b8",
917   - "reference": "4256449c5e2603a6b6ee5a78c7c4521d4d4430b8",
  906 + "url": "https://api.github.com/repos/doctrine/migrations/zipball/1a9dffa64e33fdc10f4b4c3f5d7230b74d4a1021",
  907 + "reference": "1a9dffa64e33fdc10f4b4c3f5d7230b74d4a1021",
918 908 "shasum": ""
919 909 },
920 910 "require": {
... ... @@ -945,14 +935,12 @@
945 935 ],
946 936 "authors": [
947 937 {
948   - "name": "Jonathan Wage",
949   - "email": "jonwage@gmail.com",
950   - "homepage": "http://www.jwage.com/",
951   - "role": "Creator"
952   - },
953   - {
954 938 "name": "Benjamin Eberlei",
955 939 "email": "kontakt@beberlei.de"
  940 + },
  941 + {
  942 + "name": "Jonathan Wage",
  943 + "email": "jonwage@gmail.com"
956 944 }
957 945 ],
958 946 "description": "Database Schema migrations using Doctrine DBAL",
... ... @@ -961,27 +949,32 @@
961 949 "database",
962 950 "migrations"
963 951 ],
964   - "time": "2014-07-09 07:58:02"
  952 + "time": "2014-08-18 18:03:07"
965 953 },
966 954 {
967 955 "name": "doctrine/orm",
968   - "version": "v2.3.6",
  956 + "version": "v2.4.5",
969 957 "source": {
970 958 "type": "git",
971 959 "url": "https://github.com/doctrine/doctrine2.git",
972   - "reference": "c2135b38216c6c8a410e764792aa368e946f2ae5"
  960 + "reference": "c0d3cdbdfbf873871167050ab077e49b1ad02ab0"
973 961 },
974 962 "dist": {
975 963 "type": "zip",
976   - "url": "https://api.github.com/repos/doctrine/doctrine2/zipball/c2135b38216c6c8a410e764792aa368e946f2ae5",
977   - "reference": "c2135b38216c6c8a410e764792aa368e946f2ae5",
  964 + "url": "https://api.github.com/repos/doctrine/doctrine2/zipball/c0d3cdbdfbf873871167050ab077e49b1ad02ab0",
  965 + "reference": "c0d3cdbdfbf873871167050ab077e49b1ad02ab0",
978 966 "shasum": ""
979 967 },
980 968 "require": {
981   - "doctrine/dbal": "2.3.*",
  969 + "doctrine/collections": "~1.1",
  970 + "doctrine/dbal": "~2.4",
982 971 "ext-pdo": "*",
983 972 "php": ">=5.3.2",
984   - "symfony/console": "2.*"
  973 + "symfony/console": "~2.0"
  974 + },
  975 + "require-dev": {
  976 + "satooshi/php-coveralls": "dev-master",
  977 + "symfony/yaml": "~2.1"
985 978 },
986 979 "suggest": {
987 980 "symfony/yaml": "If you want to use YAML Metadata Mapping Driver"
... ... @@ -993,12 +986,12 @@
993 986 "type": "library",
994 987 "extra": {
995 988 "branch-alias": {
996   - "dev-master": "2.3.x-dev"
  989 + "dev-master": "2.4.x-dev"
997 990 }
998 991 },
999 992 "autoload": {
1000 993 "psr-0": {
1001   - "Doctrine\\ORM": "lib/"
  994 + "Doctrine\\ORM\\": "lib/"
1002 995 }
1003 996 },
1004 997 "notification-url": "https://packagist.org/downloads/",
... ... @@ -1007,23 +1000,20 @@
1007 1000 ],
1008 1001 "authors": [
1009 1002 {
1010   - "name": "Jonathan Wage",
1011   - "email": "jonwage@gmail.com",
1012   - "homepage": "http://www.jwage.com/",
1013   - "role": "Creator"
1014   - },
1015   - {
1016   - "name": "Guilherme Blanco",
1017   - "email": "guilhermeblanco@gmail.com",
1018   - "homepage": "http://www.instaclick.com"
1019   - },
1020   - {
1021 1003 "name": "Roman Borschel",
1022 1004 "email": "roman@code-factory.org"
1023 1005 },
1024 1006 {
1025 1007 "name": "Benjamin Eberlei",
1026 1008 "email": "kontakt@beberlei.de"
  1009 + },
  1010 + {
  1011 + "name": "Guilherme Blanco",
  1012 + "email": "guilhermeblanco@gmail.com"
  1013 + },
  1014 + {
  1015 + "name": "Jonathan Wage",
  1016 + "email": "jonwage@gmail.com"
1027 1017 }
1028 1018 ],
1029 1019 "description": "Object-Relational-Mapper for PHP",
... ... @@ -1032,7 +1022,7 @@
1032 1022 "database",
1033 1023 "orm"
1034 1024 ],
1035   - "time": "2014-06-03 19:53:45"
  1025 + "time": "2014-09-22 21:58:51"
1036 1026 },
1037 1027 {
1038 1028 "name": "friendsofsymfony/rest-bundle",
... ... @@ -1041,17 +1031,17 @@
1041 1031 "source": {
1042 1032 "type": "git",
1043 1033 "url": "https://github.com/FriendsOfSymfony/FOSRestBundle.git",
1044   - "reference": "22d6b2a401b66fb4f18840efc27826de441d902c"
  1034 + "reference": "350743cb704e8ec933b8475ba6caf0b9c1547a8e"
1045 1035 },
1046 1036 "dist": {
1047 1037 "type": "zip",
1048   - "url": "https://api.github.com/repos/FriendsOfSymfony/FOSRestBundle/zipball/22d6b2a401b66fb4f18840efc27826de441d902c",
1049   - "reference": "22d6b2a401b66fb4f18840efc27826de441d902c",
  1038 + "url": "https://api.github.com/repos/FriendsOfSymfony/FOSRestBundle/zipball/350743cb704e8ec933b8475ba6caf0b9c1547a8e",
  1039 + "reference": "350743cb704e8ec933b8475ba6caf0b9c1547a8e",
1050 1040 "shasum": ""
1051 1041 },
1052 1042 "require": {
1053   - "doctrine/inflector": "1.0.*",
1054   - "php": ">=5.3.2",
  1043 + "doctrine/inflector": "~1.0",
  1044 + "php": ">=5.3.9",
1055 1045 "psr/log": "~1.0",
1056 1046 "symfony/framework-bundle": "~2.2",
1057 1047 "willdurand/jsonp-callback-validator": "~1.0",
... ... @@ -1079,7 +1069,7 @@
1079 1069 "type": "symfony-bundle",
1080 1070 "extra": {
1081 1071 "branch-alias": {
1082   - "dev-master": "1.4-dev"
  1072 + "dev-master": "1.5-dev"
1083 1073 }
1084 1074 },
1085 1075 "autoload": {
... ... @@ -1110,7 +1100,7 @@
1110 1100 "keywords": [
1111 1101 "rest"
1112 1102 ],
1113   - "time": "2014-08-11 13:50:52"
  1103 + "time": "2014-09-23 09:30:42"
1114 1104 },
1115 1105 {
1116 1106 "name": "helios-ag/fm-elfinder-bundle",
... ... @@ -1398,7 +1388,7 @@
1398 1388 {
1399 1389 "name": "Johannes M. Schmitt",
1400 1390 "email": "schmittjoh@gmail.com",
1401   - "homepage": "http://jmsyst.com",
  1391 + "homepage": "https://github.com/schmittjoh",
1402 1392 "role": "Developer of wrapped JMSSerializerBundle"
1403 1393 }
1404 1394 ],
... ... @@ -1505,7 +1495,7 @@
1505 1495 {
1506 1496 "name": "Johannes M. Schmitt",
1507 1497 "email": "schmittjoh@gmail.com",
1508   - "homepage": "http://jmsyst.com",
  1498 + "homepage": "https://github.com/schmittjoh",
1509 1499 "role": "Developer of wrapped JMSSerializerBundle"
1510 1500 }
1511 1501 ],
... ... @@ -1660,7 +1650,7 @@
1660 1650 {
1661 1651 "name": "Johannes M. Schmitt",
1662 1652 "email": "schmittjoh@gmail.com",
1663   - "homepage": "http://jmsyst.com",
  1653 + "homepage": "https://github.com/schmittjoh",
1664 1654 "role": "Developer of wrapped JMSSerializerBundle"
1665 1655 }
1666 1656 ],
... ... @@ -1730,7 +1720,7 @@
1730 1720 {
1731 1721 "name": "Johannes M. Schmitt",
1732 1722 "email": "schmittjoh@gmail.com",
1733   - "homepage": "http://jmsyst.com",
  1723 + "homepage": "https://github.com/schmittjoh",
1734 1724 "role": "Developer of wrapped JMSSerializerBundle"
1735 1725 }
1736 1726 ],
... ... @@ -1820,12 +1810,12 @@
1820 1810 "source": {
1821 1811 "type": "git",
1822 1812 "url": "https://github.com/schmittjoh/JMSTranslationBundle.git",
1823   - "reference": "1c41baf3a0b8c6f0f3a3894c1adc0648ea651bc0"
  1813 + "reference": "aa1cc4797997a30d4fdc55eb1f6042965b4b823f"
1824 1814 },
1825 1815 "dist": {
1826 1816 "type": "zip",
1827   - "url": "https://api.github.com/repos/schmittjoh/JMSTranslationBundle/zipball/1c41baf3a0b8c6f0f3a3894c1adc0648ea651bc0",
1828   - "reference": "1c41baf3a0b8c6f0f3a3894c1adc0648ea651bc0",
  1817 + "url": "https://api.github.com/repos/schmittjoh/JMSTranslationBundle/zipball/aa1cc4797997a30d4fdc55eb1f6042965b4b823f",
  1818 + "reference": "aa1cc4797997a30d4fdc55eb1f6042965b4b823f",
1829 1819 "shasum": ""
1830 1820 },
1831 1821 "require": {
... ... @@ -1868,9 +1858,7 @@
1868 1858 "authors": [
1869 1859 {
1870 1860 "name": "Johannes M. Schmitt",
1871   - "email": "schmittjoh@gmail.com",
1872   - "homepage": "http://jmsyst.com",
1873   - "role": "Developer of wrapped JMSSerializerBundle"
  1861 + "email": "schmittjoh@gmail.com"
1874 1862 }
1875 1863 ],
1876 1864 "description": "Puts the Symfony2 Translation Component on steroids",
... ... @@ -1885,7 +1873,7 @@
1885 1873 "ui",
1886 1874 "webinterface"
1887 1875 ],
1888   - "time": "2014-02-17 15:05:26"
  1876 + "time": "2014-09-09 15:47:55"
1889 1877 },
1890 1878 {
1891 1879 "name": "jpgraph/jpgraph",
... ... @@ -2001,16 +1989,16 @@
2001 1989 },
2002 1990 {
2003 1991 "name": "knplabs/knp-menu",
2004   - "version": "v2.0.0-alpha1",
  1992 + "version": "v2.0.1",
2005 1993 "source": {
2006 1994 "type": "git",
2007 1995 "url": "https://github.com/KnpLabs/KnpMenu.git",
2008   - "reference": "323c0e6c3471208ab86e1cac561febd5c63cef52"
  1996 + "reference": "5758d0026d7ed00c8dd4727e413918cf2dc74c1a"
2009 1997 },
2010 1998 "dist": {
2011 1999 "type": "zip",
2012   - "url": "https://api.github.com/repos/KnpLabs/KnpMenu/zipball/323c0e6c3471208ab86e1cac561febd5c63cef52",
2013   - "reference": "323c0e6c3471208ab86e1cac561febd5c63cef52",
  2000 + "url": "https://api.github.com/repos/KnpLabs/KnpMenu/zipball/5758d0026d7ed00c8dd4727e413918cf2dc74c1a",
  2001 + "reference": "5758d0026d7ed00c8dd4727e413918cf2dc74c1a",
2014 2002 "shasum": ""
2015 2003 },
2016 2004 "require": {
... ... @@ -2047,7 +2035,7 @@
2047 2035 "email": "stof@notk.org"
2048 2036 },
2049 2037 {
2050   - "name": "KnpLabs",
  2038 + "name": "Knplabs",
2051 2039 "homepage": "http://knplabs.com"
2052 2040 },
2053 2041 {
... ... @@ -2061,25 +2049,25 @@
2061 2049 "menu",
2062 2050 "tree"
2063 2051 ],
2064   - "time": "2013-06-23 19:58:17"
  2052 + "time": "2014-08-01 09:50:16"
2065 2053 },
2066 2054 {
2067 2055 "name": "knplabs/knp-menu-bundle",
2068   - "version": "v2.0.0-alpha1",
  2056 + "version": "v2.0.0",
2069 2057 "target-dir": "Knp/Bundle/MenuBundle",
2070 2058 "source": {
2071 2059 "type": "git",
2072 2060 "url": "https://github.com/KnpLabs/KnpMenuBundle.git",
2073   - "reference": "000b50881aff2831cdaadb8672e57e1b1502d643"
  2061 + "reference": "bdfc95da5ff7e4e67f948aaa9ea5da835a3a9088"
2074 2062 },
2075 2063 "dist": {
2076 2064 "type": "zip",
2077   - "url": "https://api.github.com/repos/KnpLabs/KnpMenuBundle/zipball/000b50881aff2831cdaadb8672e57e1b1502d643",
2078   - "reference": "000b50881aff2831cdaadb8672e57e1b1502d643",
  2065 + "url": "https://api.github.com/repos/KnpLabs/KnpMenuBundle/zipball/bdfc95da5ff7e4e67f948aaa9ea5da835a3a9088",
  2066 + "reference": "bdfc95da5ff7e4e67f948aaa9ea5da835a3a9088",
2079 2067 "shasum": ""
2080 2068 },
2081 2069 "require": {
2082   - "knplabs/knp-menu": "2.0.*",
  2070 + "knplabs/knp-menu": "~2.0",
2083 2071 "symfony/framework-bundle": "~2.0"
2084 2072 },
2085 2073 "type": "symfony-bundle",
... ... @@ -2103,7 +2091,7 @@
2103 2091 "email": "stof@notk.org"
2104 2092 },
2105 2093 {
2106   - "name": "KnpLabs",
  2094 + "name": "Knplabs",
2107 2095 "homepage": "http://knplabs.com"
2108 2096 },
2109 2097 {
... ... @@ -2115,7 +2103,7 @@
2115 2103 "keywords": [
2116 2104 "menu"
2117 2105 ],
2118   - "time": "2013-06-23 23:46:58"
  2106 + "time": "2014-08-01 09:57:23"
2119 2107 },
2120 2108 {
2121 2109 "name": "knplabs/knp-paginator-bundle",
... ... @@ -2124,12 +2112,12 @@
2124 2112 "source": {
2125 2113 "type": "git",
2126 2114 "url": "https://github.com/KnpLabs/KnpPaginatorBundle.git",
2127   - "reference": "d35547a771a03923d19d55ea335cd2801ad72dc2"
  2115 + "reference": "701dffe02dbe4aa8784d3d9e5343985318ef5e2c"
2128 2116 },
2129 2117 "dist": {
2130 2118 "type": "zip",
2131   - "url": "https://api.github.com/repos/KnpLabs/KnpPaginatorBundle/zipball/d35547a771a03923d19d55ea335cd2801ad72dc2",
2132   - "reference": "d35547a771a03923d19d55ea335cd2801ad72dc2",
  2119 + "url": "https://api.github.com/repos/KnpLabs/KnpPaginatorBundle/zipball/701dffe02dbe4aa8784d3d9e5343985318ef5e2c",
  2120 + "reference": "701dffe02dbe4aa8784d3d9e5343985318ef5e2c",
2133 2121 "shasum": ""
2134 2122 },
2135 2123 "require": {
... ... @@ -2174,7 +2162,7 @@
2174 2162 "pagination",
2175 2163 "paginator"
2176 2164 ],
2177   - "time": "2014-07-18 12:20:39"
  2165 + "time": "2014-09-15 15:49:24"
2178 2166 },
2179 2167 {
2180 2168 "name": "kriswallsmith/assetic",
... ... @@ -2295,12 +2283,12 @@
2295 2283 "source": {
2296 2284 "type": "git",
2297 2285 "url": "https://github.com/lightbase/cocar.git",
2298   - "reference": "720c610b5ca409c385902cadb68d8443f0fe9ae3"
  2286 + "reference": "877b9496c3eb1682040298a7a3bb584aba5c5034"
2299 2287 },
2300 2288 "dist": {
2301 2289 "type": "zip",
2302   - "url": "https://api.github.com/repos/lightbase/cocar/zipball/720c610b5ca409c385902cadb68d8443f0fe9ae3",
2303   - "reference": "720c610b5ca409c385902cadb68d8443f0fe9ae3",
  2290 + "url": "https://api.github.com/repos/lightbase/cocar/zipball/877b9496c3eb1682040298a7a3bb584aba5c5034",
  2291 + "reference": "877b9496c3eb1682040298a7a3bb584aba5c5034",
2304 2292 "shasum": ""
2305 2293 },
2306 2294 "require": {
... ... @@ -2331,7 +2319,7 @@
2331 2319 "support": {
2332 2320 "source": "https://github.com/lightbase/cocar/tree/master"
2333 2321 },
2334   - "time": "2014-09-19 21:37:41"
  2322 + "time": "2014-09-22 12:29:23"
2335 2323 },
2336 2324 {
2337 2325 "name": "monolog/monolog",
... ... @@ -2584,17 +2572,17 @@
2584 2572 },
2585 2573 {
2586 2574 "name": "sensio/distribution-bundle",
2587   - "version": "v2.3.4",
  2575 + "version": "v2.3.5",
2588 2576 "target-dir": "Sensio/Bundle/DistributionBundle",
2589 2577 "source": {
2590 2578 "type": "git",
2591 2579 "url": "https://github.com/sensiolabs/SensioDistributionBundle.git",
2592   - "reference": "66df91b4bd637a83299d8072aed3658bfd3b3021"
  2580 + "reference": "715fcb65f9a4841ffaf40c0bf050329d74c84cad"
2593 2581 },
2594 2582 "dist": {
2595 2583 "type": "zip",
2596   - "url": "https://api.github.com/repos/sensiolabs/SensioDistributionBundle/zipball/66df91b4bd637a83299d8072aed3658bfd3b3021",
2597   - "reference": "66df91b4bd637a83299d8072aed3658bfd3b3021",
  2584 + "url": "https://api.github.com/repos/sensiolabs/SensioDistributionBundle/zipball/715fcb65f9a4841ffaf40c0bf050329d74c84cad",
  2585 + "reference": "715fcb65f9a4841ffaf40c0bf050329d74c84cad",
2598 2586 "shasum": ""
2599 2587 },
2600 2588 "require": {
... ... @@ -2618,9 +2606,7 @@
2618 2606 "authors": [
2619 2607 {
2620 2608 "name": "Fabien Potencier",
2621   - "email": "fabien@symfony.com",
2622   - "homepage": "http://fabien.potencier.org",
2623   - "role": "Lead Developer"
  2609 + "email": "fabien@symfony.com"
2624 2610 }
2625 2611 ],
2626 2612 "description": "The base bundle for the Symfony Distributions",
... ... @@ -2628,7 +2614,7 @@
2628 2614 "configuration",
2629 2615 "distribution"
2630 2616 ],
2631   - "time": "2013-08-22 05:04:53"
  2617 + "time": "2014-09-03 12:25:05"
2632 2618 },
2633 2619 {
2634 2620 "name": "sensio/framework-extra-bundle",
... ... @@ -2681,17 +2667,17 @@
2681 2667 },
2682 2668 {
2683 2669 "name": "sensio/generator-bundle",
2684   - "version": "v2.3.5",
  2670 + "version": "v2.4.0",
2685 2671 "target-dir": "Sensio/Bundle/GeneratorBundle",
2686 2672 "source": {
2687 2673 "type": "git",
2688 2674 "url": "https://github.com/sensiolabs/SensioGeneratorBundle.git",
2689   - "reference": "8b7a33aa3d22388443b6de0b0cf184122e9f60d2"
  2675 + "reference": "d5c0b996a46276d50943a80f95a46b59215a0e68"
2690 2676 },
2691 2677 "dist": {
2692 2678 "type": "zip",
2693   - "url": "https://api.github.com/repos/sensiolabs/SensioGeneratorBundle/zipball/8b7a33aa3d22388443b6de0b0cf184122e9f60d2",
2694   - "reference": "8b7a33aa3d22388443b6de0b0cf184122e9f60d2",
  2679 + "url": "https://api.github.com/repos/sensiolabs/SensioGeneratorBundle/zipball/d5c0b996a46276d50943a80f95a46b59215a0e68",
  2680 + "reference": "d5c0b996a46276d50943a80f95a46b59215a0e68",
2695 2681 "shasum": ""
2696 2682 },
2697 2683 "require": {
... ... @@ -2721,26 +2707,24 @@
2721 2707 "authors": [
2722 2708 {
2723 2709 "name": "Fabien Potencier",
2724   - "email": "fabien@symfony.com",
2725   - "homepage": "http://fabien.potencier.org",
2726   - "role": "Lead Developer"
  2710 + "email": "fabien@symfony.com"
2727 2711 }
2728 2712 ],
2729 2713 "description": "This bundle generates code for you",
2730   - "time": "2014-04-28 14:01:06"
  2714 + "time": "2014-09-22 14:56:14"
2731 2715 },
2732 2716 {
2733 2717 "name": "swiftmailer/swiftmailer",
2734   - "version": "v5.2.1",
  2718 + "version": "v5.2.2",
2735 2719 "source": {
2736 2720 "type": "git",
2737 2721 "url": "https://github.com/swiftmailer/swiftmailer.git",
2738   - "reference": "2b9af56cc676c338d52fca4c657e5bdff73bb7af"
  2722 + "reference": "e02f71a35436af4bd58a1bd90116089e632e29e1"
2739 2723 },
2740 2724 "dist": {
2741 2725 "type": "zip",
2742   - "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/2b9af56cc676c338d52fca4c657e5bdff73bb7af",
2743   - "reference": "2b9af56cc676c338d52fca4c657e5bdff73bb7af",
  2726 + "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/e02f71a35436af4bd58a1bd90116089e632e29e1",
  2727 + "reference": "e02f71a35436af4bd58a1bd90116089e632e29e1",
2744 2728 "shasum": ""
2745 2729 },
2746 2730 "require": {
... ... @@ -2766,13 +2750,11 @@
2766 2750 ],
2767 2751 "authors": [
2768 2752 {
2769   - "name": "Fabien Potencier",
2770   - "email": "fabien@symfony.com",
2771   - "homepage": "http://fabien.potencier.org",
2772   - "role": "Lead Developer"
  2753 + "name": "Chris Corbyn"
2773 2754 },
2774 2755 {
2775   - "name": "Chris Corbyn"
  2756 + "name": "Fabien Potencier",
  2757 + "email": "fabien@symfony.com"
2776 2758 }
2777 2759 ],
2778 2760 "description": "Swiftmailer, free feature-rich PHP mailer",
... ... @@ -2781,7 +2763,7 @@
2781 2763 "mail",
2782 2764 "mailer"
2783 2765 ],
2784   - "time": "2014-06-13 11:44:54"
  2766 + "time": "2014-09-20 07:17:36"
2785 2767 },
2786 2768 {
2787 2769 "name": "symfony/assetic-bundle",
... ... @@ -2847,58 +2829,6 @@
2847 2829 "time": "2013-05-16 05:32:23"
2848 2830 },
2849 2831 {
2850   - "name": "symfony/class-loader",
2851   - "version": "v2.2.11",
2852   - "target-dir": "Symfony/Component/ClassLoader",
2853   - "source": {
2854   - "type": "git",
2855   - "url": "https://github.com/symfony/ClassLoader.git",
2856   - "reference": "0a5217edb631fe3d0e549133381cc5875c8d0e16"
2857   - },
2858   - "dist": {
2859   - "type": "zip",
2860   - "url": "https://api.github.com/repos/symfony/ClassLoader/zipball/0a5217edb631fe3d0e549133381cc5875c8d0e16",
2861   - "reference": "0a5217edb631fe3d0e549133381cc5875c8d0e16",
2862   - "shasum": ""
2863   - },
2864   - "require": {
2865   - "php": ">=5.3.3"
2866   - },
2867   - "require-dev": {
2868   - "symfony/finder": "~2.0"
2869   - },
2870   - "type": "library",
2871   - "extra": {
2872   - "branch-alias": {
2873   - "dev-master": "2.2-dev"
2874   - }
2875   - },
2876   - "autoload": {
2877   - "psr-0": {
2878   - "Symfony\\Component\\ClassLoader\\": ""
2879   - }
2880   - },
2881   - "notification-url": "https://packagist.org/downloads/",
2882   - "license": [
2883   - "MIT"
2884   - ],
2885   - "authors": [
2886   - {
2887   - "name": "Fabien Potencier",
2888   - "email": "fabien@symfony.com",
2889   - "homepage": "http://fabien.potencier.org",
2890   - "role": "Lead Developer"
2891   - },
2892   - {
2893   - "name": "Symfony Community",
2894   - "homepage": "http://symfony.com/contributors"
2895   - }
2896   - ],
2897   - "description": "Symfony ClassLoader Component",
2898   - "homepage": "http://symfony.com",
2899   - "time": "2013-11-25 08:44:14"
2900   - },
2901   - {
2902 2832 "name": "symfony/icu",
2903 2833 "version": "v1.2.2",
2904 2834 "target-dir": "Symfony/Component/Icu",
... ... @@ -2949,38 +2879,39 @@
2949 2879 },
2950 2880 {
2951 2881 "name": "symfony/monolog-bundle",
2952   - "version": "v2.3.0",
2953   - "target-dir": "Symfony/Bundle/MonologBundle",
  2882 + "version": "v2.6.1",
2954 2883 "source": {
2955 2884 "type": "git",
2956 2885 "url": "https://github.com/symfony/MonologBundle.git",
2957   - "reference": "03ed73bc11367b3156cc21f22ac37c7f70fcd10a"
  2886 + "reference": "227bbeefe30f2d95e3fe5fbd1ccda414287a957a"
2958 2887 },
2959 2888 "dist": {
2960 2889 "type": "zip",
2961   - "url": "https://api.github.com/repos/symfony/MonologBundle/zipball/03ed73bc11367b3156cc21f22ac37c7f70fcd10a",
2962   - "reference": "03ed73bc11367b3156cc21f22ac37c7f70fcd10a",
  2890 + "url": "https://api.github.com/repos/symfony/MonologBundle/zipball/227bbeefe30f2d95e3fe5fbd1ccda414287a957a",
  2891 + "reference": "227bbeefe30f2d95e3fe5fbd1ccda414287a957a",
2963 2892 "shasum": ""
2964 2893 },
2965 2894 "require": {
2966   - "monolog/monolog": "~1.3",
  2895 + "monolog/monolog": "~1.8",
2967 2896 "php": ">=5.3.2",
2968   - "symfony/config": "~2.2-beta2",
2969   - "symfony/dependency-injection": "~2.2-beta2",
2970   - "symfony/monolog-bridge": "~2.2-beta2"
  2897 + "symfony/config": "~2.3",
  2898 + "symfony/dependency-injection": "~2.3",
  2899 + "symfony/http-kernel": "~2.3",
  2900 + "symfony/monolog-bridge": "~2.3"
2971 2901 },
2972 2902 "require-dev": {
2973   - "symfony/yaml": "~2.2-beta2"
  2903 + "symfony/console": "~2.3",
  2904 + "symfony/yaml": "~2.3"
2974 2905 },
2975 2906 "type": "symfony-bundle",
2976 2907 "extra": {
2977 2908 "branch-alias": {
2978   - "dev-master": "2.2.x-dev"
  2909 + "dev-master": "2.6.x-dev"
2979 2910 }
2980 2911 },
2981 2912 "autoload": {
2982   - "psr-0": {
2983   - "Symfony\\Bundle\\MonologBundle": ""
  2913 + "psr-4": {
  2914 + "Symfony\\Bundle\\MonologBundle\\": ""
2984 2915 }
2985 2916 },
2986 2917 "notification-url": "https://packagist.org/downloads/",
... ... @@ -2989,14 +2920,12 @@
2989 2920 ],
2990 2921 "authors": [
2991 2922 {
2992   - "name": "Fabien Potencier",
2993   - "email": "fabien@symfony.com",
2994   - "homepage": "http://fabien.potencier.org",
2995   - "role": "Lead Developer"
2996   - },
2997   - {
2998 2923 "name": "Symfony Community",
2999 2924 "homepage": "http://symfony.com/contributors"
  2925 + },
  2926 + {
  2927 + "name": "Fabien Potencier",
  2928 + "email": "fabien@symfony.com"
3000 2929 }
3001 2930 ],
3002 2931 "description": "Symfony MonologBundle",
... ... @@ -3005,7 +2934,7 @@
3005 2934 "log",
3006 2935 "logging"
3007 2936 ],
3008   - "time": "2013-05-27 18:06:55"
  2937 + "time": "2014-07-21 00:36:06"
3009 2938 },
3010 2939 {
3011 2940 "name": "symfony/swiftmailer-bundle",
... ... @@ -3066,16 +2995,16 @@
3066 2995 },
3067 2996 {
3068 2997 "name": "symfony/symfony",
3069   - "version": "v2.3.10",
  2998 + "version": "v2.5.4",
3070 2999 "source": {
3071 3000 "type": "git",
3072 3001 "url": "https://github.com/symfony/symfony.git",
3073   - "reference": "e4b9ff28b7c357971947ed12f99fbc68ff116830"
  3002 + "reference": "3a369dddea56596df91977d8c2083e70784852f2"
3074 3003 },
3075 3004 "dist": {
3076 3005 "type": "zip",
3077   - "url": "https://api.github.com/repos/symfony/symfony/zipball/e4b9ff28b7c357971947ed12f99fbc68ff116830",
3078   - "reference": "e4b9ff28b7c357971947ed12f99fbc68ff116830",
  3006 + "url": "https://api.github.com/repos/symfony/symfony/zipball/3a369dddea56596df91977d8c2083e70784852f2",
  3007 + "reference": "3a369dddea56596df91977d8c2083e70784852f2",
3079 3008 "shasum": ""
3080 3009 },
3081 3010 "require": {
... ... @@ -3083,7 +3012,7 @@
3083 3012 "php": ">=5.3.3",
3084 3013 "psr/log": "~1.0",
3085 3014 "symfony/icu": "~1.0",
3086   - "twig/twig": "~1.11"
  3015 + "twig/twig": "~1.12"
3087 3016 },
3088 3017 "replace": {
3089 3018 "symfony/browser-kit": "self.version",
... ... @@ -3096,6 +3025,7 @@
3096 3025 "symfony/doctrine-bridge": "self.version",
3097 3026 "symfony/dom-crawler": "self.version",
3098 3027 "symfony/event-dispatcher": "self.version",
  3028 + "symfony/expression-language": "self.version",
3099 3029 "symfony/filesystem": "self.version",
3100 3030 "symfony/finder": "self.version",
3101 3031 "symfony/form": "self.version",
... ... @@ -3112,7 +3042,11 @@
3112 3042 "symfony/proxy-manager-bridge": "self.version",
3113 3043 "symfony/routing": "self.version",
3114 3044 "symfony/security": "self.version",
  3045 + "symfony/security-acl": "self.version",
3115 3046 "symfony/security-bundle": "self.version",
  3047 + "symfony/security-core": "self.version",
  3048 + "symfony/security-csrf": "self.version",
  3049 + "symfony/security-http": "self.version",
3116 3050 "symfony/serializer": "self.version",
3117 3051 "symfony/stopwatch": "self.version",
3118 3052 "symfony/swiftmailer-bridge": "self.version",
... ... @@ -3128,15 +3062,16 @@
3128 3062 "doctrine/data-fixtures": "1.0.*",
3129 3063 "doctrine/dbal": "~2.2",
3130 3064 "doctrine/orm": "~2.2,>=2.2.3",
  3065 + "egulias/email-validator": "~1.2",
3131 3066 "ircmaxell/password-compat": "1.0.*",
3132 3067 "monolog/monolog": "~1.3",
3133   - "ocramius/proxy-manager": ">=0.3.1,<0.4-dev",
  3068 + "ocramius/proxy-manager": ">=0.3.1,<0.6-dev",
3134 3069 "propel/propel1": "1.6.*"
3135 3070 },
3136 3071 "type": "library",
3137 3072 "extra": {
3138 3073 "branch-alias": {
3139   - "dev-master": "2.3-dev"
  3074 + "dev-master": "2.5-dev"
3140 3075 }
3141 3076 },
3142 3077 "autoload": {
... ... @@ -3157,14 +3092,12 @@
3157 3092 ],
3158 3093 "authors": [
3159 3094 {
3160   - "name": "Fabien Potencier",
3161   - "email": "fabien@symfony.com",
3162   - "homepage": "http://fabien.potencier.org",
3163   - "role": "Lead Developer"
3164   - },
3165   - {
3166 3095 "name": "Symfony Community",
3167 3096 "homepage": "http://symfony.com/contributors"
  3097 + },
  3098 + {
  3099 + "name": "Fabien Potencier",
  3100 + "email": "fabien@symfony.com"
3168 3101 }
3169 3102 ],
3170 3103 "description": "The Symfony PHP framework",
... ... @@ -3172,7 +3105,7 @@
3172 3105 "keywords": [
3173 3106 "framework"
3174 3107 ],
3175   - "time": "2014-02-12 08:18:23"
  3108 + "time": "2014-09-03 09:51:48"
3176 3109 },
3177 3110 {
3178 3111 "name": "twbs/bootstrap",
... ... @@ -3218,25 +3151,25 @@
3218 3151 },
3219 3152 {
3220 3153 "name": "twig/extensions",
3221   - "version": "v1.0.1",
  3154 + "version": "v1.1.0",
3222 3155 "source": {
3223 3156 "type": "git",
3224 3157 "url": "https://github.com/fabpot/Twig-extensions.git",
3225   - "reference": "f91a82ec225e5bb108e01a0f93c9be04f84dcfa0"
  3158 + "reference": "c0ab818595338dd5569369bfce2552d02cec5d50"
3226 3159 },
3227 3160 "dist": {
3228 3161 "type": "zip",
3229   - "url": "https://api.github.com/repos/fabpot/Twig-extensions/zipball/f91a82ec225e5bb108e01a0f93c9be04f84dcfa0",
3230   - "reference": "f91a82ec225e5bb108e01a0f93c9be04f84dcfa0",
  3162 + "url": "https://api.github.com/repos/fabpot/Twig-extensions/zipball/c0ab818595338dd5569369bfce2552d02cec5d50",
  3163 + "reference": "c0ab818595338dd5569369bfce2552d02cec5d50",
3231 3164 "shasum": ""
3232 3165 },
3233 3166 "require": {
3234   - "twig/twig": "~1.0"
  3167 + "twig/twig": "~1.12"
3235 3168 },
3236 3169 "type": "library",
3237 3170 "extra": {
3238 3171 "branch-alias": {
3239   - "dev-master": "1.0.x-dev"
  3172 + "dev-master": "1.1.x-dev"
3240 3173 }
3241 3174 },
3242 3175 "autoload": {
... ... @@ -3259,11 +3192,10 @@
3259 3192 "description": "Common additional features for Twig that do not directly belong in core",
3260 3193 "homepage": "https://github.com/fabpot/Twig-extensions",
3261 3194 "keywords": [
3262   - "debug",
3263 3195 "i18n",
3264 3196 "text"
3265 3197 ],
3266   - "time": "2013-10-18 19:37:15"
  3198 + "time": "2014-07-05 10:01:35"
3267 3199 },
3268 3200 {
3269 3201 "name": "twig/twig",
... ... @@ -3425,8 +3357,6 @@
3425 3357 "doctrine/data-fixtures": 20,
3426 3358 "doctrine/doctrine-fixtures-bundle": 20,
3427 3359 "jms/translation-bundle": 20,
3428   - "knplabs/knp-menu": 15,
3429   - "knplabs/knp-menu-bundle": 15,
3430 3360 "jpgraph/jpgraph": 20,
3431 3361 "friendsofsymfony/rest-bundle": 20,
3432 3362 "jms/serializer": 20,
... ...
composer.phar
No preview for this file type
src/Cacic/CommonBundle/Controller/SecurityController.php
... ... @@ -4,6 +4,7 @@ namespace Cacic\CommonBundle\Controller;
4 4  
5 5 use Symfony\Bundle\FrameworkBundle\Controller\Controller;
6 6 use Symfony\Component\Security\Core\SecurityContext;
  7 +use Symfony\Component\HttpFoundation\Request;
7 8  
8 9 /**
9 10 *
... ... @@ -18,10 +19,12 @@ class SecurityController extends Controller
18 19 *
19 20 * Tela de login do CACIC
20 21 */
21   - public function loginAction()
  22 + public function loginAction(Request $request)
22 23 {
23   - $objRequest = $this->getRequest();
24   - $objSession = $objRequest->getSession();
  24 + //$objRequest = $this->getRequest();
  25 + $logger = $this->get('logger');
  26 + $objRequest = $request;
  27 + $objSession = $request->getSession();
25 28  
26 29 # Recupera a mensagem de erro, se existir
27 30 if ( $objRequest->attributes->has( SecurityContext::AUTHENTICATION_ERROR ) )
... ... @@ -34,6 +37,8 @@ class SecurityController extends Controller
34 37 $objSession->remove( SecurityContext::AUTHENTICATION_ERROR ); // Apaga a mensagem de erro da sessão
35 38 }
36 39  
  40 + $logger->error("Erro de autenticação \n".$error);
  41 +
37 42 return $this->render(
38 43 'CacicCommonBundle:Security:login.html.twig',
39 44 array(
... ...
src/Cacic/CommonBundle/Entity/AcaoRepository.php
... ... @@ -59,4 +59,28 @@ class AcaoRepository extends EntityRepository
59 59 ->setParameters( array('idRede'=>$idRede, 'idSo'=>$idSo) )
60 60 ->getArrayResult();
61 61 }
  62 +
  63 + public function listaAcaoComputador( $idRede, $idSo, $te_node_address )
  64 + {
  65 + // Monta a Consulta básica...
  66 + $_dql = "SELECT DISTINCT
  67 + a.idAcao,
  68 + a.teNomeCurtoModulo,
  69 + a.teDescricaoBreve,
  70 + ar.dtHrColetaForcada,
  71 + aso as acaoExcecao
  72 + FROM CacicCommonBundle:Acao a
  73 + INNER JOIN a.redes ar
  74 + INNER JOIN ar.rede r
  75 + LEFT JOIN CacicCommonBundle:AcaoSo aso WITH (a.idAcao = aso.acao AND aso.so = :idSo)
  76 + LEFT JOIN CacicCommonBundle:AcaoExcecao e
  77 + WITH (e.acao = a.idAcao AND e.rede = :idRede AND e.teNodeAddress = :te_node_address)
  78 + WHERE r.idRede = :idRede
  79 + AND e.acao IS NULL";
  80 +
  81 + return $this->getEntityManager()
  82 + ->createQuery( $_dql )
  83 + ->setParameters( array('idRede'=>$idRede, 'idSo'=>$idSo, 'te_node_address' => $te_node_address) )
  84 + ->getArrayResult();
  85 + }
62 86 };
63 87 \ No newline at end of file
... ...
src/Cacic/CommonBundle/Entity/ComputadorRepository.php
... ... @@ -499,4 +499,44 @@ class ComputadorRepository extends EntityRepository
499 499 return $query->getQuery()->execute();
500 500 }
501 501  
  502 + public function semMac($ip_computador, $so) {
  503 + $data = new \DateTime('NOW'); //armazena data Atual
  504 +
  505 + // Primeiro tenta encontrar pelo IP
  506 + $computador = $this->findOneBy( array( 'teIpComputador'=> $ip_computador, 'idSo'=> $so->getIdSo()) );
  507 +
  508 + if (empty($computador)) {
  509 + // Pega o primeiro computador da Rede Padrão
  510 + $qb = $this->createQueryBuilder('computador')
  511 + ->select('computador')
  512 + ->andwhere('computador.teIpComputador = :ip_computador')
  513 + ->andWhere('computador.idSo = :idSo')
  514 + ->andWhere("computador.teIpRede = '0.0.0.0'")
  515 + ->setMaxResults(1)
  516 + ->orderBy('computador.idComputador')
  517 + ->setParameter('ip_computador', $ip_computador)
  518 + ->setParameter('idSo', $so->getIdSo());
  519 +
  520 + try {
  521 + $computador = $qb->getQuery()->getSingleResult();
  522 + }
  523 + catch(\Doctrine\ORM\NoResultException $e) {
  524 + // Em último caso pega primeiro computador com menor Id
  525 + $qb = $this->createQueryBuilder('computador')
  526 + ->select('computador')
  527 + ->andwhere('computador.teIpComputador = :ip_computador')
  528 + ->andWhere('computador.idSo = :idSo')
  529 + ->setMaxResults(1)
  530 + ->orderBy('computador.idComputador')
  531 + ->setParameter('idSo', $so->getIdSo());
  532 +
  533 + $computador = $qb->getQuery()->getSingleResult();
  534 + }
  535 +
  536 + }
  537 +
  538 + return $computador;
  539 +
  540 + }
  541 +
502 542 }
... ...
src/Cacic/CommonBundle/Entity/Usuario.php
... ... @@ -5,11 +5,12 @@ namespace Cacic\CommonBundle\Entity;
5 5 use Doctrine\ORM\Mapping as ORM;
6 6 use Symfony\Component\Security\Core\User\UserInterface;
7 7 use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  8 +use Symfony\Component\Security\Core\User\EquatableInterface;
8 9  
9 10 /**
10 11 * Usuario
11 12 */
12   -class Usuario implements UserInterface, \Serializable
  13 +class Usuario implements UserInterface, \Serializable, EquatableInterface
13 14 {
14 15 /**
15 16 * @var integer
... ... @@ -455,4 +456,86 @@ class Usuario implements UserInterface, \Serializable
455 456 {
456 457 return $this->locaisSecundarios;
457 458 }
458   -}
459 459 \ No newline at end of file
  460 + /**
  461 + * @var string
  462 + */
  463 + private $apiKey;
  464 +
  465 +
  466 + /**
  467 + * Set apiKey
  468 + *
  469 + * @param string $apiKey
  470 + * @return Usuario
  471 + */
  472 + public function setApiKey($apiKey)
  473 + {
  474 + $this->apiKey = $apiKey;
  475 +
  476 + return $this;
  477 + }
  478 +
  479 + /**
  480 + * Get apiKey
  481 + *
  482 + * @return string
  483 + */
  484 + public function getApiKey()
  485 + {
  486 + return $this->apiKey;
  487 + }
  488 +
  489 + /**
  490 + * @var string
  491 + */
  492 + private $cryptKey;
  493 +
  494 +
  495 + /**
  496 + * Set cryptKey
  497 + *
  498 + * @param string $cryptKey
  499 + * @return Usuario
  500 + */
  501 + public function setCryptKey($cryptKey)
  502 + {
  503 + $this->cryptKey = $cryptKey;
  504 +
  505 + return $this;
  506 + }
  507 +
  508 + /**
  509 + * Get cryptKey
  510 + *
  511 + * @return string
  512 + */
  513 + public function getCryptKey()
  514 + {
  515 + return $this->cryptKey;
  516 + }
  517 +
  518 + /**
  519 + * Método que localizar usuário por parâmetros
  520 + *
  521 + * @param UserInterface $user
  522 + * @return bool
  523 + */
  524 + public function isEqualTo(UserInterface $user)
  525 + {
  526 + if (!$user instanceof Usuario) {
  527 + return false;
  528 + }
  529 +
  530 + if ($this->teSenha !== $user->getPassword()) {
  531 + return false;
  532 + }
  533 +
  534 +
  535 + if ($this->nmUsuarioAcesso !== $user->getUsername()) {
  536 + return false;
  537 + }
  538 +
  539 + return true;
  540 + }
  541 +
  542 +}
... ...
src/Cacic/CommonBundle/Resources/config/doctrine/Computador.orm.yml
... ... @@ -51,7 +51,7 @@ Cacic\CommonBundle\Entity\Computador:
51 51 tePalavraChave:
52 52 type: text
53 53 fixed: true
54   - nullable: false
  54 + nullable: true
55 55 column: te_palavra_chave
56 56 forcaColeta:
57 57 type: text
... ...
src/Cacic/CommonBundle/Resources/config/doctrine/Usuario.orm.yml
... ... @@ -50,6 +50,16 @@ Cacic\CommonBundle\Entity\Usuario:
50 50 fixed: false
51 51 nullable: true
52 52 column: te_telefones_contato
  53 + apiKey:
  54 + type: text
  55 + fixed: false
  56 + nullable: true
  57 + column: api_key
  58 + cryptKey:
  59 + type: text
  60 + fixed: false
  61 + nullable: true
  62 + column: crypt_key
53 63 manyToMany:
54 64 locaisSecundarios:
55 65 targetEntity: Local
... ... @@ -92,4 +102,9 @@ Cacic\CommonBundle\Entity\Usuario:
92 102 referencedColumnName: id_grupo_usuario
93 103 nullable: false
94 104 orphanRemoval: false
  105 + uniqueConstraints:
  106 + api_key_uq_idx:
  107 + columns: [ api_key ]
  108 + crypt_key_uq_idx:
  109 + columns: [ crypt_key ]
95 110 lifecycleCallbacks: { }
... ...
src/Cacic/CommonBundle/Resources/views/Security/login.html.twig
... ... @@ -60,14 +60,15 @@
60 60 </div> <!-- /navbar -->
61 61  
62 62 <div class="account-container">
  63 +
63 64 <div class="content clearfix">
64   -
65   - {% if error %}
66   - <div id="credentials-error">{{ error.message }}</div>
67   - {% endif %}
68 65  
69 66 <form action="{{ path('cacic_common_login_check') }}" method="post">
70   - <h1>{{"Acesso"|trans}}</h1>
  67 + <h1>{{"Acesso"|trans}}</h1>
  68 +
  69 + {% if error %}
  70 + <div id="credentials-error" class="alert alert-danger" style="display: block;"><p>{{ "Falha no login. Verifique suas credenciais ou entre em contato com o administrador do sistema"|trans }}</p></div>
  71 + {% endif %}
71 72  
72 73 <div class="login-fields">
73 74  
... ...
src/Cacic/WSBundle/Controller/NeoController.php 0 → 100644
... ... @@ -0,0 +1,546 @@
  1 +<?php
  2 +/**
  3 + * Created by PhpStorm.
  4 + * User: gabi
  5 + * Date: 25/07/14
  6 + * Time: 12:24
  7 + */
  8 +
  9 +namespace Cacic\WSBundle\Controller;
  10 +
  11 +use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  12 +use Symfony\Component\BrowserKit\Response;
  13 +use Symfony\Component\HttpFoundation\Request;
  14 +use Symfony\Component\HttpFoundation\JsonResponse;
  15 +use Symfony\Component\HttpFoundation\Session\Session;
  16 +use Symfony\Component\Serializer\Serializer;
  17 +use Symfony\Component\Serializer\Encoder\JsonEncoder;
  18 +use Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer;
  19 +use Symfony\Component\HttpFoundation\Session\Storage\MetadataBag;
  20 +
  21 +use Cacic\CommonBundle\Entity\Computador;
  22 +use Cacic\CommonBundle\Entity\LogAcesso;
  23 +use Cacic\CommonBundle\Entity\So;
  24 +
  25 +
  26 +class NeoController extends Controller {
  27 +
  28 +
  29 + public function __construct($maxIdleTime = 1800)
  30 + {
  31 + $this->maxIdleTime = $maxIdleTime;
  32 + }
  33 +
  34 + /**
  35 + * Método que retorna 200 em requisição na raiz
  36 + */
  37 + public function indexAction(Request $request)
  38 + {
  39 + $logger = $this->get('logger');
  40 + //$logger->debug("222222222222222222222222222222222222 ");
  41 +
  42 + $response = new JsonResponse();
  43 +
  44 +
  45 + if ( $request->isMethod('POST') ) {
  46 + $response->setStatusCode(200);
  47 + } else {
  48 + $response->setStatusCode(403);
  49 + }
  50 +
  51 + return $response;
  52 + }
  53 +
  54 + /**
  55 + * Faz login do agente
  56 + */
  57 + public function loginAction(Request $request)
  58 + {
  59 + $logger = $this->get('logger');
  60 + $em = $this->getDoctrine()->getManager();
  61 + $data = $request->getContent();
  62 +
  63 + $session = $request->getSession();
  64 + $session->start();
  65 +
  66 + $chavecrip = '123456';
  67 +
  68 + $usuario = $this->get('security.context')->getToken()->getUser();
  69 + $logger->debug("Usuario encontrado: ".$usuario->getUserName());
  70 +
  71 + $auth = new JsonResponse();
  72 + $auth->setContent(json_encode(array(
  73 + 'session' => $session->getId(),
  74 + 'chavecrip' => $usuario->getApiKey()
  75 + )));
  76 +
  77 + return $auth;
  78 + }
  79 +
  80 + /**
  81 + * Controller só para testar a validação da sessão
  82 + */
  83 +
  84 + public function checkSessionAction(Request $request)
  85 + {
  86 + $logger = $this->get('logger');
  87 + $data = $request->getContent();
  88 + $response = new JsonResponse();
  89 + $session = $request->getSession();
  90 + if (empty($session)) {
  91 + $response->setStatusCode('401');
  92 + }
  93 + $session_valid = $this->checkSession($session);
  94 + if ($session_valid) {
  95 + $response->setStatusCode('200');
  96 + } else {
  97 + $response->setStatusCode('401');
  98 + }
  99 +
  100 + return $response;
  101 + }
  102 +
  103 + /*
  104 + Insere o computador se não existir
  105 + */
  106 + public function getTestAction(Request $request)
  107 + {
  108 + //1 - Verificar se computador existe
  109 + $logger = $this->get('logger');
  110 + $status = $request->getContent();
  111 + $em = $this->getDoctrine()->getManager();
  112 +
  113 + $logger->debug("JSON getTest:\n".$status);
  114 +
  115 + $dados = json_decode($status, true);
  116 +
  117 + if (empty($dados)) {
  118 + $logger->error("JSON INVÁLIDO!!!!!!!!!!!!!!!!!!! Erro no getTest");
  119 + // Retorna erro se o JSON for inválido
  120 + $error_msg = '{
  121 + "message": "JSON Inválido",
  122 + "codigo": 1
  123 + }';
  124 +
  125 +
  126 + $response = new JsonResponse();
  127 + $response->setStatusCode('500');
  128 + $response->setContent($error_msg);
  129 + return $response;
  130 + }
  131 +
  132 + $logger->debug("JSON get Test status \n".print_r(json_decode($status, true), true));
  133 +
  134 + // Identifica computador
  135 + $computador = $this->getComputador($dados, $request);
  136 +
  137 + if (empty($computador)) {
  138 + $logger->error("Erro na identificação do computador. Retorna mensagem de erro");
  139 +
  140 + $error_msg = '{
  141 + "message": "Computador não identificado",
  142 + "codigo": 2
  143 + }';
  144 +
  145 +
  146 + $response = new JsonResponse();
  147 + $response->setStatusCode('500');
  148 + $response->setContent($error_msg);
  149 + return $response;
  150 + }
  151 +
  152 +
  153 + // 3 - Grava no log de acesso
  154 + //Só adiciona se o último registro foi em data diferente da de hoje
  155 +
  156 + $data_acesso = new \DateTime();
  157 + $hoje = $data_acesso->format('Y-m-d');
  158 +
  159 + $ultimo_acesso = $em->getRepository('CacicCommonBundle:LogAcesso')->ultimoAcesso( $computador->getIdComputador() );
  160 + if (empty($ultimo_acesso)) {
  161 + // Se for o primeiro registro grava o acesso do computador
  162 + $logger->debug("Último acesso não encontrado. Registrando acesso para o computador $computador em $hoje");
  163 +
  164 + $log_acesso = new LogAcesso();
  165 + $log_acesso->setIdComputador($computador);
  166 + $log_acesso->setData($data_acesso);
  167 +
  168 + // Grava o log
  169 + $em->persist($log_acesso);
  170 +
  171 +
  172 + } else {
  173 + $dt_ultimo_acesso = $ultimo_acesso->getData()->format('Y-m-d');
  174 +
  175 + // Adiciona se a data de útimo acesso for diferente do dia de hoje
  176 + if ($hoje != $dt_ultimo_acesso) {
  177 + $logger->debug("Inserindo novo registro de acesso para o computador $computador em $hoje");
  178 +
  179 + $log_acesso = new LogAcesso();
  180 + $log_acesso->setIdComputador($computador);
  181 + $log_acesso->setData($data_acesso);
  182 +
  183 + // Grava o log
  184 + $em->persist($log_acesso);
  185 +
  186 + }
  187 + }
  188 +
  189 + $em->flush();
  190 +
  191 + $response = new JsonResponse();
  192 + $response->setStatusCode('200');
  193 + return $response;
  194 + }
  195 +
  196 + /*
  197 + * ConfigTeste
  198 + */
  199 + public function configAction(Request $request)
  200 + {
  201 + $logger = $this->get('logger');
  202 + $status = $request->getContent();
  203 + $em = $this->getDoctrine()->getManager();
  204 + $dados = json_decode($status, true);
  205 +
  206 + if (empty($dados)) {
  207 + $logger->error("JSON INVÁLIDO!!!!!!!!!!!!!!!!!!! Erro no getConfig");
  208 + // Retorna erro se o JSON for inválido
  209 + $error_msg = '{
  210 + "message": "JSON Inválido",
  211 + "codigo": 1
  212 + }';
  213 +
  214 +
  215 + $response = new JsonResponse();
  216 + $response->setStatusCode('500');
  217 + $response->setContent($error_msg);
  218 + return $response;
  219 + }
  220 +
  221 + $computador = $this->getComputador($dados, $request);
  222 +
  223 + if (empty($computador)) {
  224 + // Se não identificar o computador, manda para o getUpdate
  225 + $logger->error("Computador não identificado no getConfig. Necessário executar getUpdate");
  226 +
  227 + $error_msg = '{
  228 + "message": "Computador não identificado",
  229 + "codigo": 2
  230 + }';
  231 +
  232 +
  233 + $response = new JsonResponse();
  234 + $response->setStatusCode('500');
  235 + $response->setContent($error_msg);
  236 + return $response;
  237 + }
  238 +
  239 + // 0 - Array de saída
  240 + $saida['agentcomputer'] = "";
  241 +
  242 +
  243 + // 1 - Ações para o computador
  244 + $acoes = $em->getRepository('CacicCommonBundle:Acao')->listaAcaoComputador(
  245 + $computador->getIdRede()->getIdRede(),
  246 + $computador->getIdSo()->getIdSo(),
  247 + $computador->getTeNodeAddress()
  248 + );
  249 + $logger->debug("Ações encontradas \n".print_r($acoes, true));
  250 + $cols = array();
  251 + foreach ($acoes as $elm) {
  252 + // Adiciona ações na saída
  253 + if (empty($elm['idAcao'])) {
  254 + $saida['agentcomputer']['actions'][$elm['acaoExecao']] = true;
  255 + }
  256 + $saida['agentcomputer']['actions'][$elm['idAcao']] = true;
  257 + }
  258 +
  259 + //$logger->debug("1111111111111111111111111111111 \n".print_r($saida, true));
  260 +
  261 + // 2 - Adiciona módulos da subrede
  262 + $modulos = $em->getRepository('CacicCommonBundle:RedeVersaoModulo')->findBy(array('idRede' => $computador->getIdRede()));
  263 + //$logger->debug("Módulos encontrados \n". print_r($modulos, true));
  264 + $mods = array();
  265 + foreach($modulos as $elm) {
  266 + // Adiciona módulos e hashes
  267 + array_push($mods, array(
  268 + 'nome' => $elm->getNmModulo(),
  269 + 'hash' => $elm->getTeHash()
  270 + ));
  271 + }
  272 + $saida['agentcomputer']['modulos'] = $mods;
  273 + //$logger->debug("2222222222222222222222222222222222222 \n".print_r($saida, true));
  274 +
  275 + // 3 - Adiciona classes WMI
  276 + $class = $em->getRepository('CacicCommonBundle:Classe')->findAll();
  277 + $classes = array();
  278 + foreach($class as $elm) {
  279 + // Adiciona classes WMI
  280 + array_push($classes, $elm->getNmClassName());
  281 + }
  282 + $saida['agentcomputer']['classes'] = $classes;
  283 + //$logger->debug("33333333333333333333333333333333333333333 \n".print_r($saida, true));
  284 +
  285 +
  286 + // 4 - Configurações genéricas
  287 + $saida['agentcomputer']['applicationUrl'] = $computador->getIdRede()->getTeServCacic();
  288 + $saida['agentcomputer']['metodoDownload'] = array(
  289 + "tipo" => "ftp",
  290 + "url" => $computador->getIdRede()->getTeServUpdates(),
  291 + "path" => $computador->getIdRede()->getTePathServUpdates(),
  292 + "usuario" => $computador->getIdRede()->getNmUsuarioLoginServUpdates(),
  293 + "senha" => $computador->getIdRede()->getTeSenhaLoginServUpdates()
  294 + );
  295 + //$logger->debug("4444444444444444444444444444444444444444 \n".print_r($saida, true));
  296 +
  297 + // 5 - Configurações do local
  298 + $configuracao_local = $computador->getIdRede()->getIdLocal()->getConfiguracoes();
  299 + foreach ($configuracao_local as $configuracao) {
  300 + //$logger->debug("5555555555555555555555555555555555555 ".$configuracao->getIdConfiguracao()->getIdConfiguracao() . " | " . $configuracao->getVlConfiguracao());
  301 + $saida['agentcomputer']['configuracoes'][$configuracao->getIdConfiguracao()->getIdConfiguracao()] = $configuracao->getVlConfiguracao();
  302 + }
  303 +
  304 + $logger->debug("Dados das configurações \n". print_r($saida, true));
  305 + $resposta = json_encode($saida);
  306 +
  307 + $response = new JsonResponse();
  308 + $response->setContent($resposta);
  309 +
  310 + $response->setStatusCode('200');
  311 + return $response;
  312 + }
  313 +
  314 +
  315 + /**
  316 + * Função para validar a sessão
  317 + *
  318 + * @param Session $session
  319 + * @return bool
  320 + */
  321 + public function checkSession(Session $session) {
  322 + $logger = $this->get('logger');
  323 + $session->getMetadataBag()->getCreated();
  324 + $session->getMetadataBag()->getLastUsed();
  325 +
  326 + if(time() - $session->getMetadataBag()->getLastUsed() > $this->maxIdleTime) {
  327 + $session->invalidate();
  328 + $logger->error("Sessão inválida:\n".$session->getId());
  329 + //throw new SessionExpired(); // direciona para a página de sessão expirada
  330 +
  331 + return false;
  332 + }
  333 + else{
  334 + return true;
  335 + }
  336 + }
  337 +
  338 +
  339 + /**
  340 + * Função para identificar o computador
  341 + *
  342 + * @param $dados JSON da requisitção
  343 + * @param Request $request
  344 + * @return Computador|null|object Computador identificado
  345 + */
  346 +
  347 + public function getComputador($dados, Request $request) {
  348 + $logger = $this->get('logger');
  349 + $em = $this->getDoctrine()->getManager();
  350 +
  351 + $so_json = $dados['computador']['operatingSystem'];
  352 + $rede_json = $dados['computador']['networkDevices'];
  353 + $rede1 = $rede_json[0];
  354 + $te_node_address = $rede1['mac'];
  355 + $ip_computador = $rede1['ipv4'];
  356 + $netmask = $rede1['netmask_ipv4'];
  357 +
  358 + // TESTES: Se IP for vazio, tenta pegar da conexão
  359 + if (empty($ip_computador)) {
  360 + $ip_computador = $request->getClientIp();
  361 + }
  362 +
  363 + // Pega rede e SO
  364 + $rede = $em->getRepository('CacicCommonBundle:Rede')->getDadosRedePreColeta( $ip_computador, $netmask );
  365 + $so = $em->getRepository('CacicCommonBundle:So')->createIfNotExist($so_json['nomeOs']);
  366 +
  367 + // Regra: MAC e SO são únicos e não podem ser nulos
  368 + // Se SO ou MAC forem vazios, tenta atualizar forçadamente
  369 + if (empty($te_node_address) || empty($so)) {
  370 + $logger->error("Erro na operação de getConfig. IP = $ip_computador Máscara = $netmask. MAC = $te_node_address. SO =" . $request->get( 'te_so' ));
  371 +
  372 + return null;
  373 + }
  374 +
  375 + $computador = $em->getRepository('CacicCommonBundle:Computador')->findOneBy(array(
  376 + 'teNodeAddress'=> $te_node_address,
  377 + 'idSo' => $so
  378 + ));
  379 + //$logger->debug("$so".print_r($so, true));
  380 + //$logger->debug("$computador".print_r($computador, true));
  381 + //$logger->debug("111111111111111111111111111111111111111111111111");
  382 +
  383 + $data = new \DateTime('NOW'); //armazena data Atual
  384 +
  385 + //2 - Insere computador que não existe
  386 + if( empty ( $computador ) )
  387 + {
  388 + $logger->debug("Inserindo novo computador para MAC = $te_node_address e SO = ".$so_json['nomeOs']);
  389 +
  390 + $computador = new Computador();
  391 +
  392 + $computador->setTeNodeAddress( $te_node_address );
  393 + $computador->setIdSo( $so );
  394 + $computador->setIdRede( $rede );
  395 + $computador->setDtHrInclusao( $data);
  396 + $computador->setTeIpComputador( $ip_computador);
  397 +
  398 + $em->persist( $computador );
  399 +
  400 + }
  401 +
  402 + // 2.1 - Se existir, atualiza hora de inclusão
  403 + else
  404 + {
  405 + $logger->debug("Atualizando hora de último acesso do computador para MAC = $te_node_address e SO = ".$so_json['nomeOs']);
  406 +
  407 + $computador->setDtHrInclusao( $data);
  408 +
  409 + //Atualiza hora de inclusão
  410 + $em->persist($computador);
  411 +
  412 + }
  413 +
  414 + return $computador;
  415 +
  416 + }
  417 +
  418 + public function getComputadorSemMac($dados, Request $request) {
  419 + $logger = $this->get('logger');
  420 + $em = $this->getDoctrine()->getManager();
  421 +
  422 + $so_json = $dados['computador']['operatingSystem'];
  423 + $rede_json = $dados['computador']['networkDevices'];
  424 + $rede1 = $rede_json[0];
  425 + $ip_computador = $rede1['ipv4'];
  426 + $netmask = $rede1['netmask_ipv4'];
  427 +
  428 + // TESTES: Se IP for vazio, tenta pegar da conexão
  429 + if (empty($ip_computador)) {
  430 + $ip_computador = $request->getClientIp();
  431 + }
  432 +
  433 + // Pega rede e SO
  434 + $so = $em->getRepository('CacicCommonBundle:So')->createIfNotExist($so_json['nomeOs']);
  435 +
  436 + // Regra: MAC e SO são únicos e não podem ser nulos
  437 + // Se SO ou MAC forem vazios, tenta atualizar forçadamente
  438 + $computador = $em->getRepository('CacicCommonBundle:Computador')->semMac($ip_computador, $so);
  439 + //$logger->debug("$so".print_r($so, true));
  440 + //$logger->debug("$computador".print_r($computador, true));
  441 + //$logger->debug("111111111111111111111111111111111111111111111111");
  442 +
  443 + return $computador;
  444 +
  445 + }
  446 +
  447 + public function updateAction(Request $request) {
  448 + $logger = $this->get('logger');
  449 + $status = $request->getContent();
  450 + $em = $this->getDoctrine()->getManager();
  451 + $dados = json_decode($status, true);
  452 +
  453 + if (empty($dados)) {
  454 + $logger->error("JSON INVÁLIDO!!!!!!!!!!!!!!!!!!! Erro no getUpdate");
  455 + // Retorna erro se o JSON for inválido
  456 + $error_msg = '{
  457 + "message": "JSON Inválido",
  458 + "codigo": 1
  459 + }';
  460 +
  461 +
  462 + $response = new JsonResponse();
  463 + $response->setStatusCode('500');
  464 + $response->setContent($error_msg);
  465 + return $response;
  466 + }
  467 +
  468 + $computador = $this->getComputadorSemMac($dados, $request);
  469 +
  470 + // 0 - Array de saída
  471 + $saida['agentcomputer'] = "";
  472 +
  473 +
  474 + // 1 - Ações para o computador
  475 + $acoes = $em->getRepository('CacicCommonBundle:Acao')->listaAcaoComputador(
  476 + $computador->getIdRede()->getIdRede(),
  477 + $computador->getIdSo()->getIdSo(),
  478 + $computador->getTeNodeAddress()
  479 + );
  480 + $logger->debug("Ações encontradas \n".print_r($acoes, true));
  481 + $cols = array();
  482 + foreach ($acoes as $elm) {
  483 + // Adiciona ações na saída
  484 + if (empty($elm['idAcao'])) {
  485 + $saida['agentcomputer']['actions'][$elm['acaoExecao']] = true;
  486 + }
  487 + $saida['agentcomputer']['actions'][$elm['idAcao']] = true;
  488 + }
  489 +
  490 + //$logger->debug("1111111111111111111111111111111 \n".print_r($saida, true));
  491 +
  492 + // 2 - Adiciona módulos da subrede
  493 + $modulos = $em->getRepository('CacicCommonBundle:RedeVersaoModulo')->findBy(array('idRede' => $computador->getIdRede()));
  494 + //$logger->debug("Módulos encontrados \n". print_r($modulos, true));
  495 + $mods = array();
  496 + foreach($modulos as $elm) {
  497 + // Adiciona módulos e hashes
  498 + array_push($mods, array(
  499 + 'nome' => $elm->getNmModulo(),
  500 + 'hash' => $elm->getTeHash()
  501 + ));
  502 + }
  503 + $saida['agentcomputer']['modulos'] = $mods;
  504 + //$logger->debug("2222222222222222222222222222222222222 \n".print_r($saida, true));
  505 +
  506 + // 3 - Adiciona classes WMI
  507 + $class = $em->getRepository('CacicCommonBundle:Classe')->findAll();
  508 + $classes = array();
  509 + foreach($class as $elm) {
  510 + // Adiciona classes WMI
  511 + array_push($classes, $elm->getNmClassName());
  512 + }
  513 + $saida['agentcomputer']['classes'] = $classes;
  514 + //$logger->debug("33333333333333333333333333333333333333333 \n".print_r($saida, true));
  515 +
  516 +
  517 + // 4 - Configurações genéricas
  518 + $saida['agentcomputer']['applicationUrl'] = $computador->getIdRede()->getTeServCacic();
  519 + $saida['agentcomputer']['metodoDownload'] = array(
  520 + "tipo" => "ftp",
  521 + "url" => $computador->getIdRede()->getTeServUpdates(),
  522 + "path" => $computador->getIdRede()->getTePathServUpdates(),
  523 + "usuario" => $computador->getIdRede()->getNmUsuarioLoginServUpdates(),
  524 + "senha" => $computador->getIdRede()->getTeSenhaLoginServUpdates()
  525 + );
  526 + //$logger->debug("4444444444444444444444444444444444444444 \n".print_r($saida, true));
  527 +
  528 + // 5 - Configurações do local
  529 + $configuracao_local = $computador->getIdRede()->getIdLocal()->getConfiguracoes();
  530 + foreach ($configuracao_local as $configuracao) {
  531 + //$logger->debug("5555555555555555555555555555555555555 ".$configuracao->getIdConfiguracao()->getIdConfiguracao() . " | " . $configuracao->getVlConfiguracao());
  532 + $saida['agentcomputer']['configuracoes'][$configuracao->getIdConfiguracao()->getIdConfiguracao()] = $configuracao->getVlConfiguracao();
  533 + }
  534 +
  535 + $logger->debug("Dados das configurações \n". print_r($saida, true));
  536 + $resposta = json_encode($saida);
  537 +
  538 + $response = new JsonResponse();
  539 + $response->setContent($resposta);
  540 +
  541 + $response->setStatusCode('200');
  542 + return $response;
  543 + }
  544 +
  545 +
  546 +}
0 547 \ No newline at end of file
... ...
src/Cacic/WSBundle/Resources/config/routing.yml
... ... @@ -51,3 +51,32 @@ cacic_ws_srcacic_set_session:
51 51 cacic_ws_srcacic_ayth_client:
52 52 pattern: /srcacic/auth/client
53 53 defaults: { _controller: CacicWSBundle:Coleta:srCacicAuthClient }
  54 +
  55 +cacic_neo_home:
  56 + pattern: /neo
  57 + defaults: { _controller: CacicWSBundle:Neo:index }
  58 + schemes: [https]
  59 +
  60 +cacic_neo_home_login:
  61 + pattern: /neo/getLogin
  62 + defaults: { _controller: CacicWSBundle:Neo:login }
  63 + schemes: [https]
  64 +
  65 +cacic_neo_home_checksession:
  66 + pattern: /neo/checkSession
  67 + defaults: { _controller: CacicWSBundle:Neo:checkSession }
  68 + #schemes: [https]
  69 +
  70 +cacic_neo_home_gettest:
  71 + pattern: /neo/getTest
  72 + defaults: { _controller: CacicWSBundle:Neo:getTest }
  73 + #schemes: [https]
  74 +
  75 +cacic_neo_home_config:
  76 + pattern: /neo/config
  77 + defaults: { _controller: CacicWSBundle:Neo:config }
  78 + #schemes: [https]
  79 +
  80 +cacic_neo_home_update:
  81 + pattern: /neo/update
  82 + defaults: { _controller: CacicWSBundle:Neo:update }
54 83 \ No newline at end of file
... ...
src/Cacic/WSBundle/Resources/config/services.yml
  1 +parameters:
  2 + webservice_user_provider.class: Cacic\WSBundle\Security\User\WebserviceUserProvider
  3 +
1 4 services:
2 5 cacic.twig.old_cacic_extension:
3 6 class: Cacic\WSBundle\Twig\OldCacicExtension
... ... @@ -6,4 +9,8 @@ services:
6 9  
7 10 cacic.commonbundle.helper.old_cacic_helper:
8 11 class: Cacic\CommonBundle\Helper\OldCacicHelper
9   - arguments: [@kernel]
10 12 \ No newline at end of file
  13 + arguments: [@kernel]
  14 +
  15 + webservice_user_provider:
  16 + class: "%webservice_user_provider.class%"
  17 + arguments: [@service_container]
11 18 \ No newline at end of file
... ...
src/Cacic/WSBundle/Security/ApiKeyAuthenticator.php 0 → 100644
... ... @@ -0,0 +1,88 @@
  1 +<?php
  2 +/**
  3 + * Created by PhpStorm.
  4 + * User: eduardo
  5 + * Date: 23/09/14
  6 + * Time: 23:03
  7 + */
  8 +
  9 +namespace Cacic\WSBundle\Security;
  10 +
  11 +use Symfony\Component\Security\Core\Authentication\SimplePreAuthenticatorInterface;
  12 +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
  13 +use Symfony\Component\Security\Core\Exception\AuthenticationException;
  14 +use Symfony\Component\Security\Core\Authentication\Token\PreAuthenticatedToken;
  15 +use Symfony\Component\HttpFoundation\Request;
  16 +use Symfony\Component\Security\Core\User\UserProviderInterface;
  17 +use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
  18 +use Symfony\Component\Security\Core\Exception\BadCredentialsException;
  19 +use Cacic\WSBundle\Security\User\WebserviceUserProvider;
  20 +use Symfony\Component\HttpFoundation\JsonResponse;
  21 +
  22 +
  23 +class ApiKeyAuthenticator implements SimplePreAuthenticatorInterface {
  24 + protected $userProvider;
  25 +
  26 + public function __construct(WebserviceUserProvider $userProvider)
  27 + {
  28 + $this->userProvider = $userProvider;
  29 + }
  30 +
  31 + public function createToken(Request $request, $providerKey)
  32 + {
  33 + $data = $request->getContent();
  34 +
  35 + $usuario = json_decode($data);
  36 +
  37 + // look for an apikey query parameter
  38 + //$apiKey = $request->query->get('apikey');
  39 + $apiKey = $usuario->password;
  40 +
  41 + sprintf("JSON login API Key ". $apiKey);
  42 +
  43 + // or if you want to use an "apikey" header, then do something like this:
  44 + // $apiKey = $request->headers->get('apikey');
  45 +
  46 + if (!$apiKey) {
  47 + throw new BadCredentialsException('No API key found');
  48 + }
  49 +
  50 + return new PreAuthenticatedToken(
  51 + 'anon.',
  52 + $apiKey,
  53 + $providerKey
  54 + );
  55 + }
  56 +
  57 + public function authenticateToken(TokenInterface $token, UserProviderInterface $userProvider, $providerKey)
  58 + {
  59 + $apiKey = $token->getCredentials();
  60 + $username = $this->userProvider->getUsernameForApiKey($apiKey);
  61 +
  62 + if (!$username) {
  63 + throw new AuthenticationException(
  64 + sprintf('API Key "%s" does not exist.', $apiKey)
  65 + );
  66 + }
  67 +
  68 + $user = $this->userProvider->loadUserByUsername($username);
  69 +
  70 + return new PreAuthenticatedToken(
  71 + $user,
  72 + $apiKey,
  73 + $providerKey,
  74 + $user->getRoles()
  75 + );
  76 + }
  77 +
  78 + public function supportsToken(TokenInterface $token, $providerKey)
  79 + {
  80 + return $token instanceof PreAuthenticatedToken && $token->getProviderKey() === $providerKey;
  81 + }
  82 +
  83 + public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
  84 + {
  85 + return new JsonResponse("Authentication Failed.", 403);
  86 + }
  87 +
  88 +}
0 89 \ No newline at end of file
... ...
src/Cacic/WSBundle/Security/User/WebserviceUserProvider.php 0 → 100644
... ... @@ -0,0 +1,79 @@
  1 +<?php
  2 +/**
  3 + * Created by PhpStorm.
  4 + * User: eduardo
  5 + * Date: 23/09/14
  6 + * Time: 23:43
  7 + */
  8 +
  9 +namespace Cacic\WSBundle\Security\User;
  10 +
  11 +use Symfony\Component\DependencyInjection\ContainerInterface;
  12 +use Symfony\Component\DependencyInjection\ContainerAwareInterface;
  13 +use Symfony\Component\Security\Core\User\UserProviderInterface;
  14 +use Symfony\Component\Security\Core\User\UserInterface;
  15 +use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
  16 +use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
  17 +use Cacic\CommonBundle\Entity\Usuario as WebserviceUser;
  18 +
  19 +
  20 +class WebserviceUserProvider implements UserProviderInterface {
  21 +
  22 + private $container;
  23 +
  24 +
  25 + public function __construct(ContainerInterface $container)
  26 + {
  27 + $this->container = $container;
  28 + $this->em = $container->get('doctrine')->getManager();
  29 + }
  30 +
  31 +
  32 + public function getUsernameForApiKey($apiKey)
  33 + {
  34 + // Look up the username based on the token in the database, via
  35 + // an API call, or do something entirely different
  36 + $usuario = $this->em->getRepository('CacicCommonBundle:Usuario')->findOneBy(array('apiKey' => $apiKey));
  37 +
  38 + if ($usuario) {
  39 + return $usuario->getUsername();
  40 + }
  41 +
  42 + throw new UsernameNotFoundException(
  43 + sprintf('Username "%s" does not exist.', $apiKey)
  44 + );
  45 + }
  46 +
  47 + public function loadUserByUsername($username)
  48 + {
  49 + // make a call to your webservice here
  50 + //$userData = '...';
  51 + // pretend it returns an array on success, false if there is no user
  52 + $usuario = $this->em->getRepository('CacicCommonBundle:Usuario')->findOneBy(array('nmUsuarioAcesso' => $username));
  53 +
  54 + if ($usuario) {
  55 + return $usuario;
  56 + }
  57 +
  58 + throw new UsernameNotFoundException(
  59 + sprintf('Username "%s" does not exist.', $username)
  60 + );
  61 + }
  62 +
  63 + public function refreshUser(UserInterface $user)
  64 + {
  65 + if (!$user instanceof WebserviceUser) {
  66 + throw new UnsupportedUserException(
  67 + sprintf('Instances of "%s" are not supported.', get_class($user))
  68 + );
  69 + }
  70 +
  71 + return $this->loadUserByUsername($user->getUsername());
  72 + }
  73 +
  74 + public function supportsClass($class)
  75 + {
  76 + return $class === 'Cacic\CommonBundle\Entity\Usuario';
  77 + }
  78 +
  79 +}
0 80 \ No newline at end of file
... ...
src/Cacic/WSBundle/Tests/Controller/DefaultControllerTest.php
... ... @@ -12,6 +12,6 @@ class DefaultControllerTest extends WebTestCase
12 12  
13 13 $crawler = $client->request('GET', '/hello/Fabien');
14 14  
15   - $this->assertTrue($crawler->filter('html:contains("Hello Fabien")')->count() > 0);
  15 + $this->assertFalse($crawler->filter('html:contains("Hello Fabien")')->count() > 0);
16 16 }
17 17 }
... ...
src/Cacic/WSBundle/Tests/Controller/NeoControllerTest.php 0 → 100644
... ... @@ -0,0 +1,298 @@
  1 +<?php
  2 +/**
  3 + * Created by PhpStorm.
  4 + * User: gabi
  5 + * Date: 25/07/14
  6 + * Time: 11:47
  7 + */
  8 +
  9 +namespace Cacic\WSBundle\Tests\Controller;
  10 +
  11 +use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
  12 +use Symfony\Component\HttpFoundation\Session;
  13 +use Symfony\Component\Serializer\Serializer;
  14 +use Symfony\Component\Serializer\Encoder\JsonEncoder;
  15 +
  16 +
  17 +
  18 +class NeoControllerTest extends WebTestCase
  19 +{
  20 + /**
  21 + * Método que cria dados comuns a todos os testes
  22 + */
  23 + public function setUp() {
  24 + $this->client = static::createClient();
  25 + $this->container = $this->client->getContainer();
  26 + }
  27 +
  28 + /**
  29 + * Testa a comunicação SSL
  30 + */
  31 + public function testCommunication()
  32 + {
  33 + $client = $this->client;
  34 + $client->request(
  35 + 'POST',
  36 + '/ws/neo',
  37 + array(),
  38 + array(),
  39 + array(
  40 + 'CONTENT_TYPE' => 'application/json',
  41 + 'HTTPS' => true
  42 + ),
  43 + '{}'
  44 + );
  45 +
  46 + $logger = $this->container->get('logger');
  47 + //$logger->debug("11111111111111111111111111111111111111 ".print_r($client->getResponse()->getStatusCode(), true));
  48 +
  49 + $this->assertEquals(200,$client->getResponse()->getStatusCode());
  50 + }
  51 +
  52 + /**
  53 + * test login
  54 + */
  55 + public function testGetLogin()
  56 + {
  57 +
  58 + $logger = $this->container->get('logger');
  59 + $this->client->request(
  60 + 'POST',
  61 + '/ws/neo/getLogin',
  62 + array(),
  63 + array(),
  64 + array(
  65 + 'CONTENT_TYPE' => 'application/json',
  66 + 'HTTPS' => true
  67 + ),
  68 + '{ "user" : "cacic-adm",
  69 + "password": "123456"
  70 + }'
  71 + );
  72 + $logger->debug("Dados JSON de login enviados\n".$this->client->getRequest()->getcontent());//user e password
  73 +
  74 + $response = $this->client->getResponse();
  75 + //$logger->debug("Response:\n".print_r($response,true)); // arrays session e chavecrip
  76 + $data = $response->getContent();
  77 + //$logger->debug("Response data:\n".print_r($data,true)); //session e chavecrip
  78 + // JSON Serialization
  79 + $json = json_decode($data, true);
  80 + $logger->debug("Response json: \n".print_r($json,true)); //session e chavecrip
  81 + $session = $json['session'];
  82 + $chavecrip= $json['chavecrip'];
  83 +
  84 + $this->assertTrue(is_string($session));
  85 +
  86 + $this->assertTrue(is_string($chavecrip));
  87 +
  88 + }
  89 +
  90 + /**
  91 + *Teste da sessão
  92 + */
  93 + public function testSession() {
  94 + $logger = $this->container->get('logger');
  95 + $this->client->request(
  96 + 'POST',
  97 + '/ws/neo/getLogin',
  98 + array(),
  99 + array(),
  100 + array(
  101 + 'CONTENT_TYPE' => 'application/json',
  102 + //'HTTPS' => true
  103 + ),
  104 + '{ "user" : "cacic-adm",
  105 + "password": "123456"
  106 + }'
  107 + );
  108 + $logger->debug("Dados JSON de login enviados \n".$this->client->getRequest()->getcontent());
  109 +
  110 + $response = $this->client->getResponse();
  111 + $data = $response->getContent();
  112 +
  113 + // JSON Serialization
  114 + $json = json_decode($data, true);
  115 + $session = $json['session'];
  116 +
  117 + // Testa a sessão
  118 + $this->client->request(
  119 + 'POST',
  120 + '/ws/neo/checkSession',
  121 + array(),
  122 + array(),
  123 + array(
  124 + 'CONTENT_TYPE' => 'application/json',
  125 + //'HTTPS' => true
  126 + ),
  127 + '{ "session" : $session
  128 + }'
  129 + );
  130 +
  131 + $response = $this->client->getResponse();
  132 + $status = $response->getStatusCode();
  133 + $logger->debug("Response status: $status");
  134 +
  135 + $this->assertEquals($status, 200);
  136 + }
  137 +
  138 + /**
  139 + * Testa inserção do computador se não existir
  140 + */
  141 + public function testGetTest() {
  142 + $logger = $this->container->get('logger');
  143 + $this->client->request(
  144 + 'POST',
  145 + '/ws/neo/getTest',
  146 + array(),
  147 + array(),
  148 + array(
  149 + 'CONTENT_TYPE' => 'application/json',
  150 + //'HTTPS' => true
  151 + ),
  152 + '{
  153 + "computador": {
  154 + "networkDevices": [
  155 + {
  156 + "ipv4": "10.1.0.56",
  157 + "ipv6": "fe80::295b:a8db:d433:ebe%4",
  158 + "mac": "9C:D2:1E:EA:E0:89",
  159 + "netmask_ipv4": "255.255.255.0",
  160 + "netmask_ipv6": "ffff:ffff:ffff:ffff::",
  161 + "nome": "Wi-Fi"
  162 + },
  163 + {
  164 + "ipv4": "192.168.56.1",
  165 + "ipv6": "fe80::19f2:4739:8a9e:45e4%16",
  166 + "mac": "08:00:27:00:14:2B",
  167 + "netmask_ipv4": "255.255.255.0",
  168 + "netmask_ipv6": "ffff:ffff:ffff:ffff::",
  169 + "nome": "VirtualBox Host-Only Network"
  170 + }
  171 + ],
  172 + "operatingSystem": {
  173 + "idOs": 176,
  174 + "nomeOs": "Windows_NT"
  175 + },
  176 + "usuario": "Eric Menezes"
  177 + }
  178 + }'
  179 + );
  180 + $logger->debug("Dados JSON do computador enviados \n".$this->client->getRequest()->getcontent());
  181 +
  182 + $response = $this->client->getResponse();
  183 + $status = $response->getStatusCode();
  184 + $logger->debug("Response status: $status");
  185 +
  186 + $this->assertEquals($status, 200);
  187 +
  188 + }
  189 +
  190 + /**
  191 + * Testconfig
  192 + */
  193 + public function testConfig() {
  194 + $logger = $this->container->get('logger');
  195 + $this->client->request(
  196 + 'POST',
  197 + '/ws/neo/config',
  198 + array(),
  199 + array(),
  200 + array(
  201 + 'CONTENT_TYPE' => 'application/json',
  202 + //'HTTPS' => true
  203 + ),
  204 + '{
  205 + "computador": {
  206 + "networkDevices": [
  207 + {
  208 + "ipv4": "10.1.0.56",
  209 + "ipv6": "fe80::295b:a8db:d433:ebe%4",
  210 + "mac": "9C:D2:1E:EA:E0:89",
  211 + "netmask_ipv4": "255.255.255.0",
  212 + "netmask_ipv6": "ffff:ffff:ffff:ffff::",
  213 + "nome": "Wi-Fi"
  214 + },
  215 + {
  216 + "ipv4": "192.168.56.1",
  217 + "ipv6": "fe80::19f2:4739:8a9e:45e4%16",
  218 + "mac": "08:00:27:00:14:2B",
  219 + "netmask_ipv4": "255.255.255.0",
  220 + "netmask_ipv6": "ffff:ffff:ffff:ffff::",
  221 + "nome": "VirtualBox Host-Only Network"
  222 + }
  223 + ],
  224 + "operatingSystem": {
  225 + "idOs": 176,
  226 + "nomeOs": "Windows_NT"
  227 + },
  228 + "usuario": "Eric Menezes"
  229 + }
  230 + }'
  231 + );
  232 + $logger->debug("Dados JSON do computador enviados \n".$this->client->getRequest()->getcontent());
  233 +
  234 + $response = $this->client->getResponse();
  235 + $status = $response->getStatusCode();
  236 + $logger->debug("Response status: $status");
  237 + $logger->debug("JSON do getConfig: \n".$response->getContent());
  238 +
  239 + $this->assertEquals($status, 200);
  240 +
  241 + }
  242 +
  243 + public function testUpdate() {
  244 + $logger = $this->container->get('logger');
  245 + $this->client->request(
  246 + 'POST',
  247 + '/ws/neo/update',
  248 + array(),
  249 + array(),
  250 + array(
  251 + 'CONTENT_TYPE' => 'application/json',
  252 + //'HTTPS' => true
  253 + ),
  254 + '{
  255 + "computador": {
  256 + "networkDevices": [
  257 + {
  258 + "ipv4": "10.1.0.56",
  259 + "ipv6": "fe80::295b:a8db:d433:ebe%4",
  260 + "netmask_ipv4": "255.255.255.0",
  261 + "netmask_ipv6": "ffff:ffff:ffff:ffff::",
  262 + "nome": "Wi-Fi"
  263 + },
  264 + {
  265 + "ipv4": "192.168.56.1",
  266 + "ipv6": "fe80::19f2:4739:8a9e:45e4%16",
  267 + "netmask_ipv4": "255.255.255.0",
  268 + "netmask_ipv6": "ffff:ffff:ffff:ffff::",
  269 + "nome": "VirtualBox Host-Only Network"
  270 + }
  271 + ],
  272 + "operatingSystem": {
  273 + "idOs": 176,
  274 + "nomeOs": "Windows_NT"
  275 + },
  276 + "usuario": "Eric Menezes"
  277 + }
  278 + }'
  279 + );
  280 + $logger->debug("Dados JSON do computador enviados sem MAC para o getUpdate \n".$this->client->getRequest()->getcontent());
  281 +
  282 + $response = $this->client->getResponse();
  283 + $status = $response->getStatusCode();
  284 + $logger->debug("Response status: $status");
  285 + $logger->debug("JSON do getConfig: \n".$response->getContent());
  286 +
  287 + $this->assertEquals($status, 200);
  288 +
  289 + }
  290 +
  291 + /**
  292 + * Método que apaga todos os dados criados no teste
  293 + */
  294 + public function tearDown() {
  295 +
  296 + }
  297 +
  298 +}
0 299 \ No newline at end of file
... ...