From 3807423c0e8058c7c140579efee4215623755d8b Mon Sep 17 00:00:00 2001 From: Guilherme Donato Date: Thu, 5 Nov 2015 17:06:21 -0200 Subject: [PATCH] Added CORS support Conflicts: app/AppKernel.php app/config/config.yml composer.json composer.lock --- app/AppKernel.php | 2 + app/config/config.yml | 13 +++++ composer.json | 4 +- composer.lock | 117 ++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 131 insertions(+), 5 deletions(-) diff --git a/app/AppKernel.php b/app/AppKernel.php index 8840b89b5..4aec6d2dc 100644 --- a/app/AppKernel.php +++ b/app/AppKernel.php @@ -53,6 +53,8 @@ public function registerBundles() new OAuth2\ServerBundle\OAuth2ServerBundle(), new LoginCidadao\OpenIDBundle\LoginCidadaoOpenIDBundle(), + + new Nelmio\CorsBundle\NelmioCorsBundle(), ); if (in_array($this->getEnvironment(), array('dev', 'test'))) { diff --git a/app/config/config.yml b/app/config/config.yml index c13bfe6b1..81fced8d0 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -131,6 +131,12 @@ doctrine: countif: PROCERGS\LoginCidadao\CoreBundle\DQL\CountIf lowerunaccent: PROCERGS\LoginCidadao\CoreBundle\DQL\LowerUnaccent + datetime_functions: + date: Oro\ORM\Query\AST\Functions\SimpleFunction + + numeric_functions: + dayofweek: Oro\ORM\Query\AST\Functions\SimpleFunction + # Swiftmailer Configuration swiftmailer: transport: %mailer_transport% @@ -380,3 +386,10 @@ scheb_two_factor: security_tokens: - Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken - FOS\FacebookBundle\Security\Authentication\Token\FacebookUserToken + +nelmio_cors: + paths: + '^/api/': + allow_origin: ['*'] + allow_headers: ['*'] + allow_methods: ['POST', 'PUT', 'GET', 'DELETE'] diff --git a/composer.json b/composer.json index 59901b19a..15f1a8a4d 100644 --- a/composer.json +++ b/composer.json @@ -51,7 +51,9 @@ "bshaffer/oauth2-server-bundle": "dev-develop", "phpseclib/phpseclib": "2.0.0", "gree/jose": "^2.0", - "league/uri": "^4.0" + "league/uri": "^4.0", + "oro/doctrine-extensions": "^1.0", + "nelmio/cors-bundle": "^1.4" }, "require-dev": { "sensio/generator-bundle" : "~2.3" diff --git a/composer.lock b/composer.lock index a81691271..2ee389893 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "b8d2dbba1e6780ac3dc6a18409d27dd2", - "content-hash": "74c0766e67d63662db64f9f6c3eb795c", + "hash": "e580243fe2a2914e9929176ae785c3bb", + "content-hash": "bd68cb712a5ca1d3efbfd4c5155fc775", "packages": [ { "name": "bshaffer/oauth2-server-bundle", @@ -1322,7 +1322,7 @@ }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfSymfony/FOSUserBundle/zipball/d5b28c367d393f9d9fbc48c4138b2a74d51c0c83", + "url": "https://api.github.com/repos/FriendsOfSymfony/FOSUserBundle/zipball/45d6f40178216a840885b4ca6d7de9e67068568a", "reference": "d5b28c367d393f9d9fbc48c4138b2a74d51c0c83", "shasum": "" }, @@ -2678,7 +2678,7 @@ }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nelmio/NelmioApiDocBundle/zipball/9af37448fa2f82856d068205afa96e9874527672", + "url": "https://api.github.com/repos/nelmio/NelmioApiDocBundle/zipball/be90e8aad60b7701097b900c4a3a971a50f9862e", "reference": "9af37448fa2f82856d068205afa96e9874527672", "shasum": "" }, @@ -2747,6 +2747,115 @@ ], "time": "2015-09-30 21:35:45" }, + { + "name": "nelmio/cors-bundle", + "version": "1.4.0", + "target-dir": "Nelmio/CorsBundle", + "source": { + "type": "git", + "url": "https://github.com/nelmio/NelmioCorsBundle.git", + "reference": "553b4c5cdb3ff155f910e8f6e3e0806d42c763a6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nelmio/NelmioCorsBundle/zipball/553b4c5cdb3ff155f910e8f6e3e0806d42c763a6", + "reference": "553b4c5cdb3ff155f910e8f6e3e0806d42c763a6", + "shasum": "" + }, + "require": { + "symfony/framework-bundle": "~2.2" + }, + "require-dev": { + "matthiasnoback/symfony-dependency-injection-test": "0.2.*", + "mockery/mockery": "dev-master" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "psr-0": { + "Nelmio\\CorsBundle": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nelmio", + "homepage": "http://nelm.io" + }, + { + "name": "Symfony Community", + "homepage": "https://github.com/nelmio/NelmioCorsBundle/contributors" + } + ], + "description": "Adds CORS (Cross-Origin Resource Sharing) headers support in your Symfony2 application", + "keywords": [ + "api", + "cors", + "crossdomain" + ], + "time": "2015-01-13 17:53:27" + }, + { + "name": "oro/doctrine-extensions", + "version": "1.0.10", + "source": { + "type": "git", + "url": "https://github.com/orocrm/doctrine-extensions.git", + "reference": "0abf1f4e3b612a9e6f82a7207f10545719f2d64e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/orocrm/doctrine-extensions/zipball/0abf1f4e3b612a9e6f82a7207f10545719f2d64e", + "reference": "0abf1f4e3b612a9e6f82a7207f10545719f2d64e", + "shasum": "" + }, + "require": { + "doctrine/orm": ">=2.2.3", + "php": ">=5.3.0" + }, + "require-dev": { + "doctrine/data-fixtures": "dev-master", + "doctrine/orm": "<2.5.0", + "phpunit/phpunit": "4.*", + "symfony/yaml": ">=2.0.4" + }, + "type": "library", + "autoload": { + "psr-0": { + "Oro\\DBAL": "src/", + "Oro\\ORM": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Oro, Inc", + "homepage": "http://www.orocrm.com" + } + ], + "description": "Doctrine Extensions for MySQL and PostgreSQL.", + "homepage": "https://github.com/orocrm/doctrine-extensions/", + "keywords": [ + "database", + "doctrine", + "dql", + "function", + "mysql", + "postgresql", + "type" + ], + "time": "2015-10-08 13:56:38" + }, { "name": "phpcollection/phpcollection", "version": "0.4.0",