Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- **Security**
- security:
- providers:
- in_memory:
- memory: ~
- encoders:
- FOS\UserBundle\Model\UserInterface: sha512
- acl:
- connection: default
- role_hierarchy:
- ROLE_ADMIN: [ROLE_USER, ROLE_SONATA_ADMIN]
- ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
- SONATA:
- - ROLE_SONATA_PAGE_ADMIN_PAGE_EDIT # if you are using acl then this line must be commented
- access_control:
- # URL of FOSUserBundle which need to be available to anonymous users
- - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
- - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
- # Admin login page needs to be access without credential
- - { path: ^/admin/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- - { path: ^/admin/logout$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- - { path: ^/admin/login_check$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- # Secured part of the site
- # This config requires being logged for the whole site and having the admin role for the admin part.
- # Change these rules to adapt them to your needs
- - { path: ^/admin/, role: [ROLE_ADMIN, ROLE_SONATA_ADMIN] }
- - { path: ^/.*, role: IS_AUTHENTICATED_ANONYMOUSLY }
- providers:
- fos_userbundle:
- id: fos_user.user_manager
- firewalls:
- # Disabling the security for the web debug toolbar, the profiler and Assetic.
- dev:
- pattern: ^/(_(profiler|wdt)|css|images|js)/
- security: false
- # -> custom firewall for the admin area of the URL
- admin:
- pattern: /admin(.*)
- context: user
- form_login:
- provider: fos_userbundle
- login_path: /admin/login
- use_forward: false
- check_path: /admin/login_check
- failure_path: null
- logout:
- path: /admin/logout
- anonymous: true
- # -> end custom configuration
- # default login area for standard users
- # This firewall is used to handle the public login area
- # This part is handled by the FOS User Bundle
- main:
- pattern: .*
- context: user
- form_login:
- provider: fos_userbundle
- login_path: /login
- use_forward: false
- check_path: /login_check
- failure_path: null
- logout: true
- anonymous: true
- **Config**
- imports:
- - { resource: parameters.yml }
- - { resource: security.yml }
- - { resource: services.yml }
- - { resource: @AdminAdminBundle/Resources/config/admin.yml }
- framework:
- #esi: ~
- #translator: { fallbacks: ["%locale%"] }
- secret: "%secret%"
- router:
- resource: "%kernel.root_dir%/config/routing.yml"
- strict_requirements: ~
- form: ~
- csrf_protection: ~
- validation: { enable_annotations: true }
- templating:
- engines: ['twig']
- #assets_version: SomeVersionScheme
- default_locale: "%locale%"
- trusted_hosts: ~
- trusted_proxies: ~
- session:
- # handler_id set to null will use default session handler from php.ini
- handler_id: ~
- fragments: ~
- http_method_override: true
- # Twig Configuration
- twig:
- debug: "%kernel.debug%"
- strict_variables: "%kernel.debug%"
- # Assetic Configuration
- assetic:
- debug: "%kernel.debug%"
- use_controller: false
- bundles: [ ]
- #java: /usr/bin/java
- filters:
- cssrewrite: ~
- #closure:
- # jar: "%kernel.root_dir%/Resources/java/compiler.jar"
- #yui_css:
- # jar: "%kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar"
- # Doctrine Configuration
- doctrine:
- dbal:
- driver: "%database_driver%"
- host: "%database_host%"
- port: "%database_port%"
- dbname: "%database_name%"
- user: "%database_user%"
- password: "%database_password%"
- charset: UTF8
- # if using pdo_sqlite as your database driver:
- # 1. add the path in parameters.yml
- # e.g. database_path: "%kernel.root_dir%/data/data.db3"
- # 2. Uncomment database_path in parameters.yml.dist
- # 3. Uncomment next line:
- # path: "%database_path%"
- orm:
- auto_generate_proxy_classes: "%kernel.debug%"
- auto_mapping: true
- # Swiftmailer Configuration
- swiftmailer:
- transport: "%mailer_transport%"
- host: "%mailer_host%"
- username: "%mailer_user%"
- password: "%mailer_password%"
- spool: { type: memory }
- sonata_user:
- security_acl: true
- manager_type: orm # can be orm or mongodb
- sonata_block:
- default_contexts: [cms]
- blocks:
- sonata.user.block.menu:
- sonata.user.block.account:
- sonata.admin.block.admin_list:
- contexts: [admin]
- fos_user:
- db_driver: orm # can be orm or odm
- firewall_name: main
- user_class: Application\Sonata\UserBundle\Entity\User
- group:
- group_class: Application\Sonata\UserBundle\Entity\Group
- group_manager: sonata.user.orm.group_manager
- service:
- user_manager: sonata.user.orm.user_manager
- doctrine:
- dbal:
- types:
- json: Sonata\Doctrine\Types\JsonType
- orm:
- entity_managers:
- default:
- mappings:
- ApplicationSonataUserBundle: ~
- SonataUserBundle: ~
- **AppKernel**
- <?php
- use Symfony\Component\HttpKernel\Kernel;
- use Symfony\Component\Config\Loader\LoaderInterface;
- class AppKernel extends Kernel
- {
- public function __construct($environment, $debug)
- {
- date_default_timezone_set('America/Denver');
- parent::__construct($environment, $debug);
- }
- public function registerBundles()
- {
- $bundles = array(
- //enable symfony core shiz
- new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
- new Symfony\Bundle\SecurityBundle\SecurityBundle(),
- new Symfony\Bundle\TwigBundle\TwigBundle(),
- new Symfony\Bundle\MonologBundle\MonologBundle(),
- new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
- new Symfony\Bundle\AsseticBundle\AsseticBundle(),
- new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
- new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
- //enable sonata admin bundle
- new Sonata\CoreBundle\SonataCoreBundle(),
- new Sonata\BlockBundle\SonataBlockBundle(),
- new Knp\Bundle\MenuBundle\KnpMenuBundle(),
- new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(),
- new Sonata\AdminBundle\SonataAdminBundle(),
- new Admin\AdminBundle\AdminAdminBundle(),
- //enable sonata user bundle
- new Sonata\EasyExtendsBundle\SonataEasyExtendsBundle(),
- new FOS\UserBundle\FOSUserBundle(),
- new Sonata\UserBundle\SonataUserBundle('FOSUserBundle')
- );
- if (in_array($this->getEnvironment(), array('dev', 'test'))) {
- $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
- $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
- $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
- $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
- }
- return $bundles;
- }
- public function registerContainerConfiguration(LoaderInterface $loader)
- {
- $loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
- }
- }
- ** Composer **
- {
- "name": "symfony/framework-standard-edition",
- "license": "MIT",
- "type": "project",
- "description": "The \"Symfony Standard Edition\" distribution",
- "autoload": {
- "psr-0": { "": "src/", "SymfonyStandard": "app/" }
- },
- "require": {
- "php": ">=5.3.3",
- "symfony/symfony": "2.6.*",
- "doctrine/orm": "~2.2,>=2.2.3,<2.5",
- "doctrine/dbal": "<2.5",
- "doctrine/doctrine-bundle": "~1.2",
- "twig/extensions": "~1.0",
- "symfony/assetic-bundle": "~2.3",
- "symfony/swiftmailer-bundle": "~2.3",
- "symfony/monolog-bundle": "~2.4",
- "sensio/distribution-bundle": "~3.0,>=3.0.12",
- "sensio/framework-extra-bundle": "~3.0,>=3.0.2",
- "incenteev/composer-parameter-handler": "~2.0",
- "knplabs/knp-snappy-bundle": "dev-master",
- "knplabs/knp-menu-bundle": "~1.1",
- "sonata-project/admin-bundle": "^2.3",
- "sonata-project/doctrine-orm-admin-bundle": "^2.3",
- "sonata-project/easy-extends-bundle": "^2.1",
- "sonata-project/user-bundle": "^2.2"
- },
- "require-dev": {
- "sensio/generator-bundle": "~2.3"
- },
- "scripts": {
- "post-root-package-install": [
- "SymfonyStandard\\Composer::hookRootPackageInstall"
- ],
- "post-install-cmd": [
- "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
- "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
- "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
- "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
- "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
- "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles",
- "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
- ],
- "post-update-cmd": [
- "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
- "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
- "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
- "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
- "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
- "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles",
- "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
- ]
- },
- "config": {
- "bin-dir": "bin"
- },
- "extra": {
- "symfony-app-dir": "app",
- "symfony-web-dir": "web",
- "symfony-assets-install": "relative",
- "incenteev-parameters": {
- "file": "app/config/parameters.yml"
- },
- "branch-alias": {
- "dev-master": "2.6-dev"
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement