LightCMSUserBundle
This bundle for LightCMS is the user manager bundle., (*1)
To use it, just follow these steps :, (*2)
- Install LightCMSBundle and configure it
- Download this bundle
- Enable the Bundle
- Import routing
- Configure your yml files
- Add new user account
Follow the installation doc to install LightCMS., (*3)
Step 2: Download this bundle
Add this line into your composer.json file, (*4)
``` json
{
"require": {
"fulgurio/light-cms-user-bundle" : "dev-master"
}
}, (*5)
After, just launch composer, it will load all dependencies
``` bash
$ ./composer update
Step 3: Enable the bundle
Finally, enable the bundle in the kernel:, (*6)
``` php
<?php
// app/AppKernel.php, (*7)
public function registerBundles()
{
$bundles = array(
// ...
new Fulgurio\LightCMSUserBundle\FulgurioLightCMSUserBundle(),
);
}, (*8)
### Step 4: Import routing file
You need to put the following line before FulgurioLightCMSBundle routing :
``` yaml
# app/config/routing.yml
FulgurioLightCMSUserBundle:
resource: "@FulgurioLightCMSUserBundle/Resources/config/routing.yml"
prefix: /
You need to set on the anonymous access, and to limit admin access. Edit
config/security.yml file and put the following configuration :
``` yaml
security:
encoders:
Symfony\Component\Security\Core\User\UserInterface: plaintext
providers:
lightcms:
entity:
class: Fulgurio\LightCMSUserBundle\Entity\User
property: username
firewalls:
lightcms_secured_area:
form_login:
provider: lightcms
login_path: /login
check_path: /login_check
logout:
path: /logout
target: /
anonymous: ~
access_control:
- { path: ^/admin/, roles: ROLE_ADMIN }, (*9)
### Step 6: Add new user account
Now, you need to add your first user. To do that, there's a command with the
console :
``` bash
$ ./app/console user:add
user:add username password email [role]
Just type your login informations, like :
bash
./app/console user:add admin mypassword admin@foo.bar ROLE_ADMIN
, (*10)
Note: you need to use the role which is allowed to access to /admin, in this
document, it's ROLE_ADMIN. Actually, roles are unused, there's no difference
between ROLE_USER or ROLE_ADMIN., (*11)