View difference between Paste ID: MJ9c9qsM and nfx4iq9v
SHOW: | | - or go back to the newest paste.
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
180
    dbal:
181
        types:
182
            json: Sonata\Doctrine\Types\JsonType
183
    orm:
184
        entity_managers:
185
            default:
186
                mappings:
187
                    ApplicationSonataUserBundle: ~
188
                    SonataUserBundle: ~
189
190
**AppKernel**
191
192
193
<?php
194
195
use Symfony\Component\HttpKernel\Kernel;
196
use Symfony\Component\Config\Loader\LoaderInterface;
197
198
class AppKernel extends Kernel
199
{
200
    public function __construct($environment, $debug)
201
    {
202
        date_default_timezone_set('America/Denver');
203
        parent::__construct($environment, $debug);
204
    }
205
    
206
    public function registerBundles()
207
    {
208
        $bundles = array(
209
            //enable symfony core shiz
210
            
211
            new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
212
            new Symfony\Bundle\SecurityBundle\SecurityBundle(),
213
            new Symfony\Bundle\TwigBundle\TwigBundle(),
214
            new Symfony\Bundle\MonologBundle\MonologBundle(),
215
            new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
216
            new Symfony\Bundle\AsseticBundle\AsseticBundle(),
217
            new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
218
            new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
219
            
220
            //enable sonata admin bundle
221
            new Sonata\CoreBundle\SonataCoreBundle(),
222
            new Sonata\BlockBundle\SonataBlockBundle(),
223
            new Knp\Bundle\MenuBundle\KnpMenuBundle(),
224
            new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(),
225
            new Sonata\AdminBundle\SonataAdminBundle(),
226
            new Admin\AdminBundle\AdminAdminBundle(),
227
            
228
            //enable sonata user bundle
229
            new Sonata\EasyExtendsBundle\SonataEasyExtendsBundle(),
230
            new FOS\UserBundle\FOSUserBundle(),
231
            new Sonata\UserBundle\SonataUserBundle('FOSUserBundle')
232
            
233
        );
234
235
        if (in_array($this->getEnvironment(), array('dev', 'test'))) {
236
            $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
237
            $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
238
            $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
239
            $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
240
        }
241
242
        return $bundles;
243
    }
244
245
    public function registerContainerConfiguration(LoaderInterface $loader)
246
    {
247
        $loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
248
    }
249
}
250
251
** Composer **
252
253
{
254
    "name": "symfony/framework-standard-edition",
255
    "license": "MIT",
256
    "type": "project",
257
    "description": "The \"Symfony Standard Edition\" distribution",
258
    "autoload": {
259
        "psr-0": { "": "src/", "SymfonyStandard": "app/" }
260
    },
261
    "require": {
262
        "php": ">=5.3.3",
263
        "symfony/symfony": "2.6.*",
264
        "doctrine/orm": "~2.2,>=2.2.3,<2.5",
265
        "doctrine/dbal": "<2.5",
266
        "doctrine/doctrine-bundle": "~1.2",
267
        "twig/extensions": "~1.0",
268
        "symfony/assetic-bundle": "~2.3",
269
        "symfony/swiftmailer-bundle": "~2.3",
270
        "symfony/monolog-bundle": "~2.4",
271
        "sensio/distribution-bundle": "~3.0,>=3.0.12",
272
        "sensio/framework-extra-bundle": "~3.0,>=3.0.2",
273
        "incenteev/composer-parameter-handler": "~2.0",
274
        "knplabs/knp-snappy-bundle": "dev-master",
275
        "knplabs/knp-menu-bundle": "~1.1",
276
        "sonata-project/admin-bundle": "^2.3",
277
        "sonata-project/doctrine-orm-admin-bundle": "^2.3",
278
        "sonata-project/easy-extends-bundle": "^2.1",
279
        "sonata-project/user-bundle": "^2.2"
280
    },
281
    "require-dev": {
282
        "sensio/generator-bundle": "~2.3"
283
    },
284
    "scripts": {
285
        "post-root-package-install": [
286
            "SymfonyStandard\\Composer::hookRootPackageInstall"
287
        ],
288
        "post-install-cmd": [
289
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
290
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
291
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
292
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
293
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
294
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles",
295
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
296
        ],
297
        "post-update-cmd": [
298
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
299
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
300
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
301
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
302
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
303
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles",
304
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
305
        ]
306
    },
307
    "config": {
308
        "bin-dir": "bin"
309
    },
310
    "extra": {
311
        "symfony-app-dir": "app",
312
        "symfony-web-dir": "web",
313
        "symfony-assets-install": "relative",
314
        "incenteev-parameters": {
315
            "file": "app/config/parameters.yml"
316
        },
317
        "branch-alias": {
318
            "dev-master": "2.6-dev"
319
        }
320
    }
321
}