Advertisement
Guest User

Untitled

a guest
May 4th, 2015
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. **Security**
  2. security:
  3.     providers:
  4.         in_memory:
  5.             memory: ~
  6.     encoders:
  7.         FOS\UserBundle\Model\UserInterface: sha512
  8.  
  9.     acl:
  10.         connection: default
  11.  
  12.     role_hierarchy:
  13.         ROLE_ADMIN:      [ROLE_USER, ROLE_SONATA_ADMIN]
  14.         ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
  15.         SONATA:
  16.            - ROLE_SONATA_PAGE_ADMIN_PAGE_EDIT  # if you are using acl then this line must be commented
  17.     access_control:
  18.        # URL of FOSUserBundle which need to be available to anonymous users
  19.         - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
  20.         - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
  21.         - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
  22.  
  23.         # Admin login page needs to be access without credential
  24.         - { path: ^/admin/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
  25.         - { path: ^/admin/logout$, role: IS_AUTHENTICATED_ANONYMOUSLY }
  26.         - { path: ^/admin/login_check$, role: IS_AUTHENTICATED_ANONYMOUSLY }
  27.  
  28.         # Secured part of the site
  29.         # This config requires being logged for the whole site and having the admin role for the admin part.
  30.         # Change these rules to adapt them to your needs
  31.         - { path: ^/admin/, role: [ROLE_ADMIN, ROLE_SONATA_ADMIN] }
  32.         - { path: ^/.*, role: IS_AUTHENTICATED_ANONYMOUSLY }
  33.        
  34.     providers:
  35.         fos_userbundle:
  36.             id: fos_user.user_manager
  37.  
  38.     firewalls:
  39.        # Disabling the security for the web debug toolbar, the profiler and Assetic.
  40.         dev:
  41.             pattern: ^/(_(profiler|wdt)|css|images|js)/
  42.             security: false
  43.  
  44.         # -> custom firewall for the admin area of the URL
  45.         admin:
  46.             pattern:           /admin(.*)
  47.             context:           user
  48.             form_login:
  49.                 provider:      fos_userbundle
  50.                 login_path:    /admin/login
  51.                 use_forward:   false
  52.                 check_path:    /admin/login_check
  53.                 failure_path:  null
  54.             logout:
  55.                 path:          /admin/logout
  56.             anonymous:         true
  57.  
  58.         # -> end custom configuration
  59.  
  60.         # default login area for standard users
  61.  
  62.         # This firewall is used to handle the public login area
  63.         # This part is handled by the FOS User Bundle
  64.         main:
  65.             pattern:            .*
  66.             context:            user
  67.             form_login:
  68.                 provider:      fos_userbundle
  69.                 login_path:    /login
  70.                 use_forward:   false
  71.                 check_path:    /login_check
  72.                 failure_path:  null
  73.             logout:            true
  74.             anonymous:         true
  75.  
  76.  
  77. **Config**
  78. imports:
  79.     - { resource: parameters.yml }
  80.     - { resource: security.yml }
  81.     - { resource: services.yml }
  82.     - { resource: @AdminAdminBundle/Resources/config/admin.yml }
  83.  
  84. framework:
  85.    #esi:             ~
  86.     #translator:      { fallbacks: ["%locale%"] }
  87.     secret:         "%secret%"
  88.     router:
  89.         resource: "%kernel.root_dir%/config/routing.yml"
  90.         strict_requirements: ~
  91.     form:           ~
  92.     csrf_protection: ~
  93.     validation:     { enable_annotations: true }
  94.     templating:
  95.         engines: ['twig']
  96.         #assets_version: SomeVersionScheme
  97.     default_locale: "%locale%"
  98.     trusted_hosts:  ~
  99.     trusted_proxies: ~
  100.     session:
  101.        # handler_id set to null will use default session handler from php.ini
  102.         handler_id: ~
  103.     fragments:      ~
  104.     http_method_override: true
  105.  
  106. # Twig Configuration
  107. twig:
  108.     debug:           "%kernel.debug%"
  109.     strict_variables: "%kernel.debug%"
  110.  
  111.  
  112.  
  113. # Assetic Configuration
  114. assetic:
  115.     debug:         "%kernel.debug%"
  116.     use_controller: false
  117.     bundles:       [ ]
  118.     #java: /usr/bin/java
  119.     filters:
  120.         cssrewrite: ~
  121.         #closure:
  122.         #    jar: "%kernel.root_dir%/Resources/java/compiler.jar"
  123.         #yui_css:
  124.         #    jar: "%kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar"
  125.  
  126. # Doctrine Configuration
  127. doctrine:
  128.     dbal:
  129.         driver:  "%database_driver%"
  130.         host:    "%database_host%"
  131.         port:    "%database_port%"
  132.         dbname:  "%database_name%"
  133.         user:    "%database_user%"
  134.         password: "%database_password%"
  135.         charset: UTF8
  136.         # if using pdo_sqlite as your database driver:
  137.         #   1. add the path in parameters.yml
  138.         #     e.g. database_path: "%kernel.root_dir%/data/data.db3"
  139.         #   2. Uncomment database_path in parameters.yml.dist
  140.         #   3. Uncomment next line:
  141.         #     path:     "%database_path%"
  142.  
  143.     orm:
  144.         auto_generate_proxy_classes: "%kernel.debug%"
  145.         auto_mapping: true
  146.  
  147. # Swiftmailer Configuration
  148. swiftmailer:
  149.     transport: "%mailer_transport%"
  150.     host:     "%mailer_host%"
  151.     username: "%mailer_user%"
  152.     password: "%mailer_password%"
  153.     spool:    { type: memory }
  154. sonata_user:
  155.     security_acl: true
  156.     manager_type: orm # can be orm or mongodb
  157.    
  158. sonata_block:
  159.     default_contexts: [cms]
  160.     blocks:
  161.         sonata.user.block.menu:
  162.         sonata.user.block.account:
  163.         sonata.admin.block.admin_list:
  164.             contexts:  [admin]
  165. fos_user:
  166.     db_driver:     orm # can be orm or odm
  167.     firewall_name: main
  168.     user_class:    Application\Sonata\UserBundle\Entity\User
  169.  
  170.  
  171.     group:
  172.         group_class:  Application\Sonata\UserBundle\Entity\Group
  173.         group_manager: sonata.user.orm.group_manager
  174.  
  175.     service:
  176.         user_manager: sonata.user.orm.user_manager
  177.  
  178. doctrine:
  179.     dbal:
  180.         types:
  181.             json: Sonata\Doctrine\Types\JsonType
  182.     orm:
  183.         entity_managers:
  184.             default:
  185.                 mappings:
  186.                     ApplicationSonataUserBundle: ~
  187.                     SonataUserBundle: ~
  188.  
  189. **AppKernel**
  190.  
  191.  
  192. <?php
  193.  
  194. use Symfony\Component\HttpKernel\Kernel;
  195. use Symfony\Component\Config\Loader\LoaderInterface;
  196.  
  197. class AppKernel extends Kernel
  198. {
  199.     public function __construct($environment, $debug)
  200.     {
  201.         date_default_timezone_set('America/Denver');
  202.         parent::__construct($environment, $debug);
  203.     }
  204.    
  205.     public function registerBundles()
  206.     {
  207.         $bundles = array(
  208.             //enable symfony core shiz
  209.            
  210.             new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
  211.             new Symfony\Bundle\SecurityBundle\SecurityBundle(),
  212.             new Symfony\Bundle\TwigBundle\TwigBundle(),
  213.             new Symfony\Bundle\MonologBundle\MonologBundle(),
  214.             new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
  215.             new Symfony\Bundle\AsseticBundle\AsseticBundle(),
  216.             new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
  217.             new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
  218.            
  219.             //enable sonata admin bundle
  220.             new Sonata\CoreBundle\SonataCoreBundle(),
  221.             new Sonata\BlockBundle\SonataBlockBundle(),
  222.             new Knp\Bundle\MenuBundle\KnpMenuBundle(),
  223.             new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(),
  224.             new Sonata\AdminBundle\SonataAdminBundle(),
  225.             new Admin\AdminBundle\AdminAdminBundle(),
  226.            
  227.             //enable sonata user bundle
  228.             new Sonata\EasyExtendsBundle\SonataEasyExtendsBundle(),
  229.             new FOS\UserBundle\FOSUserBundle(),
  230.             new Sonata\UserBundle\SonataUserBundle('FOSUserBundle')
  231.            
  232.         );
  233.  
  234.         if (in_array($this->getEnvironment(), array('dev', 'test'))) {
  235.             $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
  236.             $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
  237.             $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
  238.             $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
  239.         }
  240.  
  241.         return $bundles;
  242.     }
  243.  
  244.     public function registerContainerConfiguration(LoaderInterface $loader)
  245.     {
  246.         $loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
  247.     }
  248. }
  249.  
  250. ** Composer **
  251.  
  252. {
  253.     "name": "symfony/framework-standard-edition",
  254.     "license": "MIT",
  255.     "type": "project",
  256.     "description": "The \"Symfony Standard Edition\" distribution",
  257.     "autoload": {
  258.         "psr-0": { "": "src/", "SymfonyStandard": "app/" }
  259.     },
  260.     "require": {
  261.         "php": ">=5.3.3",
  262.         "symfony/symfony": "2.6.*",
  263.         "doctrine/orm": "~2.2,>=2.2.3,<2.5",
  264.         "doctrine/dbal": "<2.5",
  265.         "doctrine/doctrine-bundle": "~1.2",
  266.         "twig/extensions": "~1.0",
  267.         "symfony/assetic-bundle": "~2.3",
  268.         "symfony/swiftmailer-bundle": "~2.3",
  269.         "symfony/monolog-bundle": "~2.4",
  270.         "sensio/distribution-bundle": "~3.0,>=3.0.12",
  271.         "sensio/framework-extra-bundle": "~3.0,>=3.0.2",
  272.         "incenteev/composer-parameter-handler": "~2.0",
  273.         "knplabs/knp-snappy-bundle": "dev-master",
  274.         "knplabs/knp-menu-bundle": "~1.1",
  275.         "sonata-project/admin-bundle": "^2.3",
  276.         "sonata-project/doctrine-orm-admin-bundle": "^2.3",
  277.         "sonata-project/easy-extends-bundle": "^2.1",
  278.         "sonata-project/user-bundle": "^2.2"
  279.     },
  280.     "require-dev": {
  281.         "sensio/generator-bundle": "~2.3"
  282.     },
  283.     "scripts": {
  284.         "post-root-package-install": [
  285.             "SymfonyStandard\\Composer::hookRootPackageInstall"
  286.         ],
  287.         "post-install-cmd": [
  288.             "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
  289.             "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
  290.             "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
  291.             "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
  292.             "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
  293.             "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles",
  294.             "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
  295.         ],
  296.         "post-update-cmd": [
  297.             "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
  298.             "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
  299.             "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
  300.             "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
  301.             "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
  302.             "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles",
  303.             "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
  304.         ]
  305.     },
  306.     "config": {
  307.         "bin-dir": "bin"
  308.     },
  309.     "extra": {
  310.         "symfony-app-dir": "app",
  311.         "symfony-web-dir": "web",
  312.         "symfony-assets-install": "relative",
  313.         "incenteev-parameters": {
  314.             "file": "app/config/parameters.yml"
  315.         },
  316.         "branch-alias": {
  317.             "dev-master": "2.6-dev"
  318.         }
  319.     }
  320. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement