mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Merge branch 'master' of github.com:Chill-project/Main
This commit is contained in:
commit
4f453f1a00
1
.gitignore
vendored
1
.gitignore
vendored
@ -14,6 +14,7 @@ web/bundles/*
|
|||||||
# Configuration files
|
# Configuration files
|
||||||
app/config/parameters.ini
|
app/config/parameters.ini
|
||||||
app/config/parameters.yml
|
app/config/parameters.yml
|
||||||
|
Tests/Fixtures/App/config/parameters.yml
|
||||||
|
|
||||||
#composer
|
#composer
|
||||||
composer.lock
|
composer.lock
|
||||||
|
@ -1,63 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\MainBundle\DataFixtures\ORM;
|
|
||||||
|
|
||||||
use Doctrine\Common\DataFixtures\AbstractFixture;
|
|
||||||
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
|
|
||||||
use Doctrine\Common\Persistence\ObjectManager;
|
|
||||||
use Chill\MainBundle\Entity\Agent;
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Load agents into database
|
|
||||||
*
|
|
||||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
|
||||||
*/
|
|
||||||
class LoadAgents extends AbstractFixture implements ContainerAwareInterface {
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @var ContainerInterface
|
|
||||||
*/
|
|
||||||
private $container;
|
|
||||||
|
|
||||||
const AGENT_STRING = 'agent';
|
|
||||||
|
|
||||||
public function getOrder() {
|
|
||||||
return 1000;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setContainer(ContainerInterface $container = null) {
|
|
||||||
$this->container = $container;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function load(ObjectManager $manager) {
|
|
||||||
|
|
||||||
echo "creating agents... \n";
|
|
||||||
|
|
||||||
$userManager = $this->container->get('fos_user.user_manager');
|
|
||||||
|
|
||||||
for ($i = 0; $i < 10; $i++) {
|
|
||||||
$username = 'agent'.$i;
|
|
||||||
echo "creating agent $username (password $username) \n";
|
|
||||||
|
|
||||||
$user = $userManager->createUser();
|
|
||||||
|
|
||||||
$user->setUsername($username)
|
|
||||||
->setPassword($username)
|
|
||||||
->setName($username)
|
|
||||||
->setEmail($username.'@chill.be');
|
|
||||||
|
|
||||||
$this->container->get('fos_user.user_manager')->updateUser($user, false);
|
|
||||||
|
|
||||||
$this->addReference($username, $user);
|
|
||||||
}
|
|
||||||
|
|
||||||
$manager->flush();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
68
DataFixtures/ORM/LoadCenters.php
Normal file
68
DataFixtures/ORM/LoadCenters.php
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Chill is a suite of a modules, Chill is a software for social workers
|
||||||
|
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Chill\MainBundle\DataFixtures\ORM;
|
||||||
|
|
||||||
|
use Doctrine\Common\DataFixtures\AbstractFixture;
|
||||||
|
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
|
||||||
|
use Doctrine\Common\Persistence\ObjectManager;
|
||||||
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||||
|
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
|
||||||
|
use Chill\MainBundle\Entity\Center;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||||
|
*/
|
||||||
|
class LoadCenters extends AbstractFixture implements OrderedFixtureInterface
|
||||||
|
{
|
||||||
|
public function getOrder()
|
||||||
|
{
|
||||||
|
return 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static $centers = array(
|
||||||
|
array(
|
||||||
|
'name' => 'Center A',
|
||||||
|
'ref' => 'centerA'
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'name' => 'Center B',
|
||||||
|
'ref' => 'centerB'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
public static $refs = array();
|
||||||
|
|
||||||
|
public function load(ObjectManager $manager)
|
||||||
|
{
|
||||||
|
foreach (static::$centers as $new) {
|
||||||
|
$centerA = new Center();
|
||||||
|
$centerA->setName($new['name']);
|
||||||
|
|
||||||
|
$manager->persist($centerA);
|
||||||
|
$this->addReference($new['ref'], $centerA);
|
||||||
|
static::$refs[] = $new['ref'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$manager->flush();
|
||||||
|
}
|
||||||
|
}
|
63
DataFixtures/ORM/LoadGroupCenters.php
Normal file
63
DataFixtures/ORM/LoadGroupCenters.php
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Chill is a suite of a modules, Chill is a software for social workers
|
||||||
|
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Chill\MainBundle\DataFixtures\ORM;
|
||||||
|
|
||||||
|
use Doctrine\Common\DataFixtures\AbstractFixture;
|
||||||
|
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
|
||||||
|
use Doctrine\Common\Persistence\ObjectManager;
|
||||||
|
use Chill\MainBundle\Entity\GroupCenter;
|
||||||
|
use Chill\MainBundle\DataFixtures\ORM\LoadCenters;
|
||||||
|
use Chill\MainBundle\DataFixtures\ORM\LoadPermissionsGroup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||||
|
*/
|
||||||
|
class LoadGroupCenters extends AbstractFixture implements OrderedFixtureInterface
|
||||||
|
{
|
||||||
|
public function getOrder()
|
||||||
|
{
|
||||||
|
return 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static $refs = array();
|
||||||
|
|
||||||
|
public function load(ObjectManager $manager)
|
||||||
|
{
|
||||||
|
foreach (LoadCenters::$refs as $centerRef) {
|
||||||
|
foreach (LoadPermissionsGroup::$refs as $permissionGroupRef) {
|
||||||
|
$GroupCenter = new GroupCenter();
|
||||||
|
$GroupCenter->setCenter($this->getReference($centerRef));
|
||||||
|
$GroupCenter->addPermissionGroup($this->getReference($permissionGroupRef));
|
||||||
|
|
||||||
|
$manager->persist($GroupCenter);
|
||||||
|
|
||||||
|
$reference = $centerRef.'_'.$permissionGroupRef;
|
||||||
|
$this->addReference($reference, $GroupCenter);
|
||||||
|
static::$refs[] = $reference;
|
||||||
|
echo "Creating $reference... \n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$manager->flush();
|
||||||
|
}
|
||||||
|
}
|
87
DataFixtures/ORM/LoadPermissionsGroup.php
Normal file
87
DataFixtures/ORM/LoadPermissionsGroup.php
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Chill is a suite of a modules, Chill is a software for social workers
|
||||||
|
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Chill\MainBundle\DataFixtures\ORM;
|
||||||
|
|
||||||
|
use Doctrine\Common\DataFixtures\AbstractFixture;
|
||||||
|
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
|
||||||
|
use Doctrine\Common\Persistence\ObjectManager;
|
||||||
|
use Chill\MainBundle\Entity\PermissionsGroup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||||
|
*/
|
||||||
|
class LoadPermissionsGroup extends AbstractFixture implements OrderedFixtureInterface
|
||||||
|
{
|
||||||
|
public function getOrder()
|
||||||
|
{
|
||||||
|
return 400;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static $permissionGroup = array(
|
||||||
|
array(
|
||||||
|
'name' => 'social',
|
||||||
|
'role_scopes' => array(
|
||||||
|
'role_scope_CHILL_FOO_EDIT_social',
|
||||||
|
'role_scope_CHILL_FOO_SEE_administrative',
|
||||||
|
"role_scope_CHILL_FOO_EDIT_all"
|
||||||
|
)
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'name' => 'administrative',
|
||||||
|
'role_scopes' => array(
|
||||||
|
"role_scope_CHILL_FOO_SEE_social",
|
||||||
|
"role_scope_CHILL_FOO_EDIT_administrative",
|
||||||
|
"role_scope_CHILL_FOO_EDIT_all"
|
||||||
|
)
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'name' => 'direction',
|
||||||
|
'role_scopes' => array(
|
||||||
|
"role_scope_CHILL_FOO_EDIT_all",
|
||||||
|
"role_scope_CHILL_FOO_SEE_DETAILS_social",
|
||||||
|
"role_scope_CHILL_FOO_SEE_DETAILS_administrative"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
public static $refs = array();
|
||||||
|
|
||||||
|
public function load(ObjectManager $manager)
|
||||||
|
{
|
||||||
|
foreach (static::$permissionGroup as $new) {
|
||||||
|
$permissionGroup = new PermissionsGroup();
|
||||||
|
$permissionGroup->setName($new['name']);
|
||||||
|
foreach ($new['role_scopes'] as $roleScopeRef) {
|
||||||
|
$permissionGroup->addRoleScope($this->getReference($roleScopeRef));
|
||||||
|
}
|
||||||
|
|
||||||
|
$manager->persist($permissionGroup);
|
||||||
|
$reference = 'permission_group_'.$new['name'];
|
||||||
|
echo "Creating $reference \n";
|
||||||
|
$this->setReference($reference, $permissionGroup);
|
||||||
|
static::$refs[] = $reference;
|
||||||
|
}
|
||||||
|
|
||||||
|
$manager->flush();
|
||||||
|
}
|
||||||
|
}
|
86
DataFixtures/ORM/LoadRoleScopes.php
Normal file
86
DataFixtures/ORM/LoadRoleScopes.php
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Chill is a suite of a modules, Chill is a software for social workers
|
||||||
|
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Chill\MainBundle\DataFixtures\ORM;
|
||||||
|
|
||||||
|
use Doctrine\Common\DataFixtures\AbstractFixture;
|
||||||
|
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
|
||||||
|
use Doctrine\Common\Persistence\ObjectManager;
|
||||||
|
use Chill\MainBundle\Entity\RoleScope;
|
||||||
|
use Chill\MainBundle\DataFixtures\ORM\LoadScopes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||||
|
*/
|
||||||
|
class LoadRoleScopes extends AbstractFixture implements OrderedFixtureInterface
|
||||||
|
{
|
||||||
|
public function getOrder()
|
||||||
|
{
|
||||||
|
return 300;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static $permissions = array(
|
||||||
|
'CHILL_FOO_SEE' => array(
|
||||||
|
'names' => array(
|
||||||
|
'fr' => 'voir foo',
|
||||||
|
'en' => 'see foo',
|
||||||
|
'nl' => 'zie foo'
|
||||||
|
)
|
||||||
|
),
|
||||||
|
'CHILL_FOO_SEE_DETAILS' => array(
|
||||||
|
'names' => array(
|
||||||
|
'fr' => 'voir foo avec détails',
|
||||||
|
'en' => 'see foo with details',
|
||||||
|
'nl' => 'zie foo in details'
|
||||||
|
)
|
||||||
|
),
|
||||||
|
'CHILL_FOO_EDIT' => array(
|
||||||
|
'names' => array(
|
||||||
|
'fr' => 'modifier foo',
|
||||||
|
'en' => 'edit foo',
|
||||||
|
'nl' => 'editie foo'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
public static $references = array();
|
||||||
|
|
||||||
|
public function load(ObjectManager $manager)
|
||||||
|
{
|
||||||
|
foreach (static::$permissions as $key => $permission) {
|
||||||
|
foreach(LoadScopes::$references as $scopeReference) {
|
||||||
|
$roleScope = new RoleScope();
|
||||||
|
$roleScope->setRole($key)
|
||||||
|
->setScope($this->getReference($scopeReference))
|
||||||
|
;
|
||||||
|
$reference = 'role_scope_'.$key.'_'.$this->getReference($scopeReference)->getName()['en'];
|
||||||
|
echo "Creating $reference \n";
|
||||||
|
$this->addReference($reference, $roleScope);
|
||||||
|
$manager->persist($roleScope);
|
||||||
|
static::$references[] = $reference;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$manager->flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
82
DataFixtures/ORM/LoadScopes.php
Normal file
82
DataFixtures/ORM/LoadScopes.php
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Chill is a suite of a modules, Chill is a software for social workers
|
||||||
|
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Chill\MainBundle\DataFixtures\ORM;
|
||||||
|
|
||||||
|
use Doctrine\Common\DataFixtures\AbstractFixture;
|
||||||
|
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
|
||||||
|
use Doctrine\Common\Persistence\ObjectManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create scopes
|
||||||
|
*
|
||||||
|
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||||
|
*/
|
||||||
|
class LoadScopes extends AbstractFixture implements OrderedFixtureInterface
|
||||||
|
{
|
||||||
|
public function getOrder()
|
||||||
|
{
|
||||||
|
return 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
public $scopes = array(
|
||||||
|
array(
|
||||||
|
'names' => array(
|
||||||
|
'fr' => 'tous',
|
||||||
|
'en' => 'all',
|
||||||
|
'nl' => 'algemeen'
|
||||||
|
),
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'names' => array(
|
||||||
|
'fr' => 'social',
|
||||||
|
'en' => 'social',
|
||||||
|
'nl' => 'sociaal'
|
||||||
|
)
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'names' => array(
|
||||||
|
'fr' => 'administratif',
|
||||||
|
'en' => 'administrative',
|
||||||
|
'nl' => 'administratief'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
public static $references = array();
|
||||||
|
|
||||||
|
public function load(ObjectManager $manager)
|
||||||
|
{
|
||||||
|
|
||||||
|
$scopesReferences = array();
|
||||||
|
|
||||||
|
foreach ($this->scopes as $new) {
|
||||||
|
$scope = new \Chill\MainBundle\Entity\Scope();
|
||||||
|
$scope->setName($new['names']);
|
||||||
|
|
||||||
|
$manager->persist($scope);
|
||||||
|
$reference = 'scope_'.$new['names']['en'];
|
||||||
|
$this->addReference($reference, $scope);
|
||||||
|
static::$references[] = $reference;
|
||||||
|
}
|
||||||
|
|
||||||
|
$manager->flush();
|
||||||
|
}
|
||||||
|
}
|
72
DataFixtures/ORM/LoadUsers.php
Normal file
72
DataFixtures/ORM/LoadUsers.php
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\MainBundle\DataFixtures\ORM;
|
||||||
|
|
||||||
|
use Doctrine\Common\DataFixtures\AbstractFixture;
|
||||||
|
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
|
||||||
|
use Doctrine\Common\Persistence\ObjectManager;
|
||||||
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||||
|
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
|
||||||
|
use Chill\MainBundle\DataFixtures\ORM\LoadCenters;
|
||||||
|
use Chill\MainBundle\DataFixtures\ORM\LoadPermissionsGroup;
|
||||||
|
use Chill\MainBundle\Entity\User;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load fixtures users into database
|
||||||
|
*
|
||||||
|
* create a user for each permission_group and center.
|
||||||
|
* username and password are identicals.
|
||||||
|
*
|
||||||
|
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||||
|
*/
|
||||||
|
class LoadUsers extends AbstractFixture implements OrderedFixtureInterface, ContainerAwareInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var ContainerInterface
|
||||||
|
*/
|
||||||
|
private $container;
|
||||||
|
|
||||||
|
public function getOrder()
|
||||||
|
{
|
||||||
|
return 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static $refs = array();
|
||||||
|
|
||||||
|
public function load(ObjectManager $manager)
|
||||||
|
{
|
||||||
|
foreach(LoadCenters::$refs as $centerRef) {
|
||||||
|
foreach(LoadPermissionsGroup::$refs as $permissionGroupRef) {
|
||||||
|
$user = new User();
|
||||||
|
|
||||||
|
$permissionGroup = $this->getReference($permissionGroupRef);
|
||||||
|
$center = $this->getReference($centerRef);
|
||||||
|
$username = $center->getName().'_'.$permissionGroup->getName();
|
||||||
|
|
||||||
|
$user->setUsername($username)
|
||||||
|
->setPassword($this->container->get('security.encoder_factory')
|
||||||
|
->getEncoder($user)
|
||||||
|
->encodePassword($username, $user->getSalt()));
|
||||||
|
$user->addGroupCenter($this->getReference($centerRef.'_'.$permissionGroupRef));
|
||||||
|
|
||||||
|
$manager->persist($user);
|
||||||
|
$this->addReference($username, $user);
|
||||||
|
static::$refs[] = $user->getUsername();
|
||||||
|
echo "Creating user with username ".$user->getUsername()."... \n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$manager->flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setContainer(ContainerInterface $container = null)
|
||||||
|
{
|
||||||
|
if (NULL === $container) {
|
||||||
|
throw new \LogicException('$container should not be null');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->container = $container;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,64 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\MainBundle\Entity;
|
|
||||||
|
|
||||||
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Agent
|
|
||||||
*/
|
|
||||||
class Agent {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var integer
|
|
||||||
*/
|
|
||||||
protected $id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $name;
|
|
||||||
|
|
||||||
public function __construct() {
|
|
||||||
parent::__construct();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get id
|
|
||||||
*
|
|
||||||
* @return integer
|
|
||||||
*/
|
|
||||||
public function getId()
|
|
||||||
{
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set name
|
|
||||||
*
|
|
||||||
* @param string $name
|
|
||||||
* @return Agent
|
|
||||||
*/
|
|
||||||
public function setName($name)
|
|
||||||
{
|
|
||||||
$this->name = $name;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get name
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getName()
|
|
||||||
{
|
|
||||||
return $this->name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function __toString() {
|
|
||||||
return parent::__toString();
|
|
||||||
}
|
|
||||||
}
|
|
81
Entity/Center.php
Normal file
81
Entity/Center.php
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Chill\MainBundle\Entity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||||
|
*/
|
||||||
|
class Center
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
private $id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var \Doctrine\Common\Collections\Collection
|
||||||
|
*/
|
||||||
|
private $groupCenters;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->groupCenters = new \Doctrine\Common\Collections\ArrayCollection();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getName()
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setName($name)
|
||||||
|
{
|
||||||
|
$this->name = $name;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getId()
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getGroupCenters()
|
||||||
|
{
|
||||||
|
return $this->groupCenters;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addGroupCenter(GroupCenter $groupCenter)
|
||||||
|
{
|
||||||
|
$this->groupCenters->add($groupCenter);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
118
Entity/GroupCenter.php
Normal file
118
Entity/GroupCenter.php
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Chill is a suite of a modules, Chill is a software for social workers
|
||||||
|
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Chill\MainBundle\Entity;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Entity\Center;
|
||||||
|
use Chill\MainBundle\Entity\PermissionsGroup;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||||
|
*/
|
||||||
|
class GroupCenter
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
private $id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var Center
|
||||||
|
*/
|
||||||
|
private $center;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var Collection
|
||||||
|
*/
|
||||||
|
private $users;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var Collection
|
||||||
|
*/
|
||||||
|
private $permissionGroups;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->permissionGroups = new ArrayCollection();
|
||||||
|
$this->users = new ArrayCollection();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getId()
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return Center
|
||||||
|
*/
|
||||||
|
public function getCenter()
|
||||||
|
{
|
||||||
|
return $this->center;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return PermissionGroup[]
|
||||||
|
*/
|
||||||
|
public function getPermissionGroups()
|
||||||
|
{
|
||||||
|
return $this->permissionGroups;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param Center $center
|
||||||
|
* @return \Chill\MainBundle\Entity\GroupCenter
|
||||||
|
*/
|
||||||
|
public function setCenter(Center $center)
|
||||||
|
{
|
||||||
|
$this->center = $center;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param PermissionGroup $permission
|
||||||
|
* @return \Chill\MainBundle\Entity\GroupCenter
|
||||||
|
*/
|
||||||
|
public function addPermissionGroup(PermissionsGroup $permission)
|
||||||
|
{
|
||||||
|
$this->permissionGroups->add($permission);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUsers()
|
||||||
|
{
|
||||||
|
return $this->users;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
88
Entity/PermissionsGroup.php
Normal file
88
Entity/PermissionsGroup.php
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Chill is a suite of a modules, Chill is a software for social workers
|
||||||
|
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Chill\MainBundle\Entity;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Entity\RoleScope;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||||
|
*/
|
||||||
|
class PermissionsGroup
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
private $id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var \Doctrine\Common\Collections\Collection
|
||||||
|
*/
|
||||||
|
private $roleScopes;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->roleScopes = new \Doctrine\Common\Collections\ArrayCollection();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getId()
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getName()
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRoleScopes()
|
||||||
|
{
|
||||||
|
return $this->roleScopes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setName($name)
|
||||||
|
{
|
||||||
|
$this->name = $name;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addRoleScope(RoleScope $roleScope)
|
||||||
|
{
|
||||||
|
$this->roleScopes->add($roleScope);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
94
Entity/RoleScope.php
Normal file
94
Entity/RoleScope.php
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Chill is a suite of a modules, Chill is a software for social workers
|
||||||
|
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Chill\MainBundle\Entity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||||
|
*/
|
||||||
|
class RoleScope
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
private $id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $role;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var Scope
|
||||||
|
*/
|
||||||
|
private $scope;
|
||||||
|
|
||||||
|
public function getId()
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getRole()
|
||||||
|
{
|
||||||
|
return $this->role;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return Scope
|
||||||
|
*/
|
||||||
|
public function getScope()
|
||||||
|
{
|
||||||
|
return $this->scope;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param type $role
|
||||||
|
* @return \Chill\MainBundle\Entity\RoleScope
|
||||||
|
*/
|
||||||
|
public function setRole($role)
|
||||||
|
{
|
||||||
|
$this->role = $role;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param \Chill\MainBundle\Entity\Scope $scope
|
||||||
|
* @return \Chill\MainBundle\Entity\RoleScope
|
||||||
|
*/
|
||||||
|
public function setScope(Scope $scope)
|
||||||
|
{
|
||||||
|
$this->scope = $scope;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
93
Entity/Scope.php
Normal file
93
Entity/Scope.php
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Chill is a suite of a modules, Chill is a software for social workers
|
||||||
|
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Chill\MainBundle\Entity;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Entity\RoleScope;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||||
|
*/
|
||||||
|
class Scope
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
private $id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* translatable names
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
private $name = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var \Doctrine\Common\Collections\Collection
|
||||||
|
*/
|
||||||
|
private $roleScopes;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->roleScopes = new \Doctrine\Common\Collections\ArrayCollection();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getId()
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getName()
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setName($name)
|
||||||
|
{
|
||||||
|
$this->name = $name;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return \Doctrine\Common\Collections\Collection
|
||||||
|
*/
|
||||||
|
public function getRoleScopes()
|
||||||
|
{
|
||||||
|
return $this->roleScopes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addRoleScope(RoleScope $roleScope)
|
||||||
|
{
|
||||||
|
$this->roleScopes->add($roleScope);
|
||||||
|
}
|
||||||
|
}
|
188
Entity/User.php
Normal file
188
Entity/User.php
Normal file
@ -0,0 +1,188 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\MainBundle\Entity;
|
||||||
|
|
||||||
|
use Symfony\Component\Security\Core\User\AdvancedUserInterface;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User
|
||||||
|
*/
|
||||||
|
class User implements AdvancedUserInterface {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var integer
|
||||||
|
*/
|
||||||
|
protected $id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $username;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $password;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @internal must be set to null if we use bcrypt
|
||||||
|
*/
|
||||||
|
private $salt = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
private $locked = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
private $enabled = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var Collection
|
||||||
|
*/
|
||||||
|
private $groupCenters;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->groupCenters = new ArrayCollection();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get id
|
||||||
|
*
|
||||||
|
* @return integer
|
||||||
|
*/
|
||||||
|
public function getId()
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set username
|
||||||
|
*
|
||||||
|
* @param string $name
|
||||||
|
* @return Agent
|
||||||
|
*/
|
||||||
|
public function setUsername($name)
|
||||||
|
{
|
||||||
|
$this->username = $name;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __toString() {
|
||||||
|
return $this->getUsername();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function eraseCredentials()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getPassword()
|
||||||
|
{
|
||||||
|
return $this->password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRoles()
|
||||||
|
{
|
||||||
|
return 'ROLE_USER';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSalt()
|
||||||
|
{
|
||||||
|
return $this->salt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUsername()
|
||||||
|
{
|
||||||
|
return $this->username;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setPassword($password)
|
||||||
|
{
|
||||||
|
$this->password = $password;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setSalt($salt)
|
||||||
|
{
|
||||||
|
$this->salt = $salt;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function isAccountNonExpired()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function isAccountNonLocked()
|
||||||
|
{
|
||||||
|
return $this->locked;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function isCredentialsNonExpired()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function isEnabled()
|
||||||
|
{
|
||||||
|
return $this->enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return GroupCenter[]
|
||||||
|
*/
|
||||||
|
public function getGroupCenters()
|
||||||
|
{
|
||||||
|
return $this->groupCenters;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param \Chill\MainBundle\Entity\GroupCenter $groupCenter
|
||||||
|
* @return \Chill\MainBundle\Entity\User
|
||||||
|
*/
|
||||||
|
public function addGroupCenter(GroupCenter $groupCenter)
|
||||||
|
{
|
||||||
|
$this->groupCenters->add($groupCenter);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -3,4 +3,4 @@ ChillMain
|
|||||||
|
|
||||||
An app for social-profit organisations
|
An app for social-profit organisations
|
||||||
|
|
||||||
[](http://travis-ci.org/#!/Champs-Libres/ChillMain)
|
[](http://travis-ci.org/#!/Chill-project/Main.png)
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
Chill\MainBundle\Entity\Agent:
|
|
||||||
type: entity
|
|
||||||
table: agents
|
|
||||||
id:
|
|
||||||
id:
|
|
||||||
type: integer
|
|
||||||
id: true
|
|
||||||
generator:
|
|
||||||
strategy: AUTO
|
|
||||||
fields:
|
|
||||||
name:
|
|
||||||
type: string
|
|
||||||
length: 80
|
|
||||||
|
|
17
Resources/config/doctrine/Center.orm.yml
Normal file
17
Resources/config/doctrine/Center.orm.yml
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
Chill\MainBundle\Entity\Center:
|
||||||
|
type: entity
|
||||||
|
table: centers
|
||||||
|
id:
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
id: true
|
||||||
|
generator:
|
||||||
|
strategy: AUTO
|
||||||
|
fields:
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
length: 255
|
||||||
|
oneToMany:
|
||||||
|
groupCenters:
|
||||||
|
targetEntity: Chill\MainBundle\Entity\GroupCenter
|
||||||
|
mappedBy: groupCenters
|
16
Resources/config/doctrine/GroupCenter.orm.yml
Normal file
16
Resources/config/doctrine/GroupCenter.orm.yml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
Chill\MainBundle\Entity\GroupCenter:
|
||||||
|
type: entity
|
||||||
|
table: group_centers
|
||||||
|
id:
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
id: true
|
||||||
|
generator:
|
||||||
|
strategy: AUTO
|
||||||
|
manyToOne:
|
||||||
|
center:
|
||||||
|
targetEntity: Chill\MainBundle\Entity\Center
|
||||||
|
inversedBy: groupCenters
|
||||||
|
manyToMany:
|
||||||
|
permissionGroups:
|
||||||
|
targetEntity: Chill\MainBundle\Entity\PermissionsGroup
|
17
Resources/config/doctrine/PermissionsGroup.orm.yml
Normal file
17
Resources/config/doctrine/PermissionsGroup.orm.yml
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
Chill\MainBundle\Entity\PermissionsGroup:
|
||||||
|
type: entity
|
||||||
|
table: permission_groups
|
||||||
|
id:
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
id: true
|
||||||
|
generator:
|
||||||
|
strategy: AUTO
|
||||||
|
fields:
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
length: 255
|
||||||
|
manyToMany:
|
||||||
|
roleScopes:
|
||||||
|
targetEntity: Chill\MainBundle\Entity\RoleScope
|
||||||
|
|
17
Resources/config/doctrine/RoleScope.orm.yml
Normal file
17
Resources/config/doctrine/RoleScope.orm.yml
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
Chill\MainBundle\Entity\RoleScope:
|
||||||
|
type: entity
|
||||||
|
table: role_scopes
|
||||||
|
id:
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
id: true
|
||||||
|
generator:
|
||||||
|
strategy: AUTO
|
||||||
|
fields:
|
||||||
|
role:
|
||||||
|
type: string
|
||||||
|
length: 255
|
||||||
|
manyToOne:
|
||||||
|
scope:
|
||||||
|
targetEntity: Chill\MainBundle\Entity\Scope
|
||||||
|
inversedBy: roleScopes
|
16
Resources/config/doctrine/Scope.orm.yml
Normal file
16
Resources/config/doctrine/Scope.orm.yml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
Chill\MainBundle\Entity\Scope:
|
||||||
|
type: entity
|
||||||
|
table: scopes
|
||||||
|
id:
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
id: true
|
||||||
|
generator:
|
||||||
|
strategy: AUTO
|
||||||
|
fields:
|
||||||
|
name:
|
||||||
|
type: json_array
|
||||||
|
oneToMany:
|
||||||
|
roleScopes:
|
||||||
|
targetEntity: Chill\MainBundle\Entity\RoleScope
|
||||||
|
mappedBy: scope
|
31
Resources/config/doctrine/User.orm.yml
Normal file
31
Resources/config/doctrine/User.orm.yml
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
Chill\MainBundle\Entity\User:
|
||||||
|
type: entity
|
||||||
|
table: users
|
||||||
|
id:
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
id: true
|
||||||
|
generator:
|
||||||
|
strategy: AUTO
|
||||||
|
fields:
|
||||||
|
username:
|
||||||
|
type: string
|
||||||
|
length: 80
|
||||||
|
password:
|
||||||
|
type: string
|
||||||
|
length: 255
|
||||||
|
salt:
|
||||||
|
type: string
|
||||||
|
length: 255
|
||||||
|
nullable: true
|
||||||
|
enabled:
|
||||||
|
type: boolean
|
||||||
|
default: true
|
||||||
|
locked:
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
manyToMany:
|
||||||
|
groupCenters:
|
||||||
|
targetEntity: Chill\MainBundle\Entity\GroupCenter
|
||||||
|
|
||||||
|
|
@ -13,6 +13,7 @@ class AppKernel extends Kernel
|
|||||||
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
|
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
|
||||||
new Symfony\Bundle\TwigBundle\TwigBundle(),
|
new Symfony\Bundle\TwigBundle\TwigBundle(),
|
||||||
new \Symfony\Bundle\AsseticBundle\AsseticBundle(),
|
new \Symfony\Bundle\AsseticBundle\AsseticBundle(),
|
||||||
|
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
imports:
|
||||||
|
- { resource: parameters.yml }
|
||||||
|
|
||||||
framework:
|
framework:
|
||||||
secret: Not very secret
|
secret: Not very secret
|
||||||
router: { resource: "%kernel.root_dir%/config/routing.yml" }
|
router: { resource: "%kernel.root_dir%/config/routing.yml" }
|
||||||
@ -9,3 +12,14 @@ framework:
|
|||||||
profiler: { only_exceptions: false }
|
profiler: { only_exceptions: false }
|
||||||
templating:
|
templating:
|
||||||
engines: ['twig']
|
engines: ['twig']
|
||||||
|
|
||||||
|
# Doctrine Configuration
|
||||||
|
doctrine:
|
||||||
|
dbal:
|
||||||
|
driver: pdo_pgsql
|
||||||
|
host: "%database_host%"
|
||||||
|
port: "%database_port%"
|
||||||
|
dbname: "%database_name%"
|
||||||
|
user: "%database_user%"
|
||||||
|
password: "%database_password%"
|
||||||
|
charset: UTF8
|
||||||
|
11
Tests/Fixtures/App/config/parameters.yml.dist
Normal file
11
Tests/Fixtures/App/config/parameters.yml.dist
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
parameters:
|
||||||
|
database_host: 127.0.0.1
|
||||||
|
database_port: 5435
|
||||||
|
database_name: chill
|
||||||
|
database_user: chill
|
||||||
|
database_password: chill
|
||||||
|
locale: fr
|
||||||
|
secret: ThisTokenIsNotSoSecretChangeIt
|
||||||
|
debug_toolbar: true
|
||||||
|
debug_redirects: false
|
||||||
|
use_assetic_controller: true
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "chill-project/main",
|
"name": "chill-project/main",
|
||||||
"license": "GPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"type": "symfony-bundle",
|
"type": "symfony-bundle",
|
||||||
"description": "The main bundle for the Chill App",
|
"description": "The main bundle for the Chill App",
|
||||||
"keywords" : ["chill", "social work"],
|
"keywords" : ["chill", "social work"],
|
||||||
@ -21,9 +21,14 @@
|
|||||||
"symfony/monolog-bundle": "~2.4",
|
"symfony/monolog-bundle": "~2.4",
|
||||||
"symfony/framework-bundle": "2.5.*",
|
"symfony/framework-bundle": "2.5.*",
|
||||||
"symfony/yaml": "2.5.*",
|
"symfony/yaml": "2.5.*",
|
||||||
"symfony/symfony": "2.5.*"
|
"symfony/symfony": "2.5.*",
|
||||||
|
"doctrine/dbal": "2.5.*@dev",
|
||||||
|
"doctrine/orm": "2.5.*@dev",
|
||||||
|
"doctrine/common": "2.4.*@dev",
|
||||||
|
"doctrine/doctrine-bundle": "~1.2@dev"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"symfony/dom-crawler": "2.5"
|
"symfony/dom-crawler": "2.5",
|
||||||
|
"doctrine/doctrine-fixtures-bundle": "~2.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user