mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
implements user-scope-role-scope first work
This commit is contained in:
parent
729ded374e
commit
873e758fef
1
.gitignore
vendored
1
.gitignore
vendored
@ -14,6 +14,7 @@ web/bundles/*
|
||||
# Configuration files
|
||||
app/config/parameters.ini
|
||||
app/config/parameters.yml
|
||||
Tests/Fixtures/App/config/parameters.yml
|
||||
|
||||
#composer
|
||||
composer.lock
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
108
Entity/User.php
Normal file
108
Entity/User.php
Normal file
@ -0,0 +1,108 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\MainBundle\Entity;
|
||||
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
|
||||
/**
|
||||
* Agent
|
||||
*/
|
||||
class User implements UserInterface {
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $username;
|
||||
|
||||
private $password;
|
||||
|
||||
private $salt;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->username;
|
||||
}
|
||||
|
||||
public function __toString() {
|
||||
return $this->getUsername();
|
||||
}
|
||||
|
||||
public function eraseCredentials()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
Chill\MainBundle\Entity\Agent:
|
||||
Chill\MainBundle\Entity\Center:
|
||||
type: entity
|
||||
table: agents
|
||||
table: centers
|
||||
id:
|
||||
id:
|
||||
type: integer
|
||||
@ -9,6 +9,4 @@ Chill\MainBundle\Entity\Agent:
|
||||
strategy: AUTO
|
||||
fields:
|
||||
name:
|
||||
type: string
|
||||
length: 80
|
||||
|
||||
type: json_array
|
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
|
||||
oneToMany:
|
||||
scope:
|
||||
targetEntity: Chill\MainBundle\Entity\Scope
|
||||
mappedBy: 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
|
||||
manyToOne:
|
||||
roleScopes:
|
||||
targetEntity: Chill\MainBundle\Entity\RoleScope
|
||||
inversedBy: scope
|
21
Resources/config/doctrine/User.orm.yml
Normal file
21
Resources/config/doctrine/User.orm.yml
Normal file
@ -0,0 +1,21 @@
|
||||
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
|
||||
|
||||
|
@ -13,6 +13,7 @@ class AppKernel extends Kernel
|
||||
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
|
||||
new Symfony\Bundle\TwigBundle\TwigBundle(),
|
||||
new \Symfony\Bundle\AsseticBundle\AsseticBundle(),
|
||||
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
imports:
|
||||
- { resource: parameters.yml }
|
||||
|
||||
framework:
|
||||
secret: Not very secret
|
||||
router: { resource: "%kernel.root_dir%/config/routing.yml" }
|
||||
@ -9,3 +12,14 @@ framework:
|
||||
profiler: { only_exceptions: false }
|
||||
templating:
|
||||
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
|
@ -21,7 +21,11 @@
|
||||
"symfony/monolog-bundle": "~2.4",
|
||||
"symfony/framework-bundle": "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": {
|
||||
"symfony/dom-crawler": "2.5"
|
||||
|
Loading…
x
Reference in New Issue
Block a user