properties for user oauth

This commit is contained in:
Kayn Ty 2018-04-25 14:47:31 +02:00
parent 6424c3738e
commit 627a1de48f
12 changed files with 141 additions and 34 deletions

View File

@ -107,13 +107,13 @@ hwi_oauth:
scope: "email"
options:
csrf: true
facebook:
type: facebook
client_id: "%facebook_id%"
client_secret: "%facebook_secret%"
scope: "email"
options:
csrf: true
# facebook:
# type: facebook
# client_id: "%facebook_id%"
# client_secret: "%facebook_secret%"
# scope: "email"
# options:
# csrf: true
twitter:
type: twitter
client_id: "%twitter_id%"
@ -121,3 +121,10 @@ hwi_oauth:
scope: "email"
options:
csrf: true
disqus:
type: disqus
client_id: "%disqus_id%"
client_secret: "%disqus_secret%"
scope: "email"
options:
csrf: true

View File

@ -1,3 +1,7 @@
hwi_oauth_login:
resource: "@HWIOAuthBundle/Resources/config/routing/login.xml"
prefix: /login
hwi_oauth_redirect:
resource: "@HWIOAuthBundle/Resources/config/routing/redirect.xml"
prefix: /connect
@ -6,12 +10,8 @@ hwi_oauth_connect:
resource: "@HWIOAuthBundle/Resources/config/routing/connect.xml"
prefix: /connect
hwi_oauth_login:
resource: "@HWIOAuthBundle/Resources/config/routing/login.xml"
prefix: /login
facebook_login:
path: /login/check-facebook
#facebook_login:
# path: /login/check-facebook
google_login:
path: /login/check-google

View File

@ -8,6 +8,22 @@ security:
fos_userbundle:
id: fos_user.user_provider.username
firewalls:
secured_area:
anonymous: ~
logout_on_user_change: true
oauth:
resource_owners:
# facebook: "/login/check-facebook"
google: "/login/check-google"
disqus: "/login/check-disqus"
twitter: "/login/check-twitter"
# my_custom_provider: "/login/check-custom"
login_path: /login
use_forward: false
failure_path: /login
oauth_user_provider:
service: my.oauth_aware.user_provider.service
# disables authentication for assets and the profiler, adapt it according to your needs
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
@ -26,24 +42,6 @@ security:
# activate different ways to authenticate
# https://symfony.com/doc/current/security.html#a-configuring-how-your-users-will-authenticate
#http_basic: ~
secured_area:
anonymous: ~
logout_on_user_change: true
oauth:
resource_owners:
facebook: "/login/check-facebook"
google: "/login/check-google"
# disqus: "/login/check-disqus"
# my_custom_provider: "/login/check-custom"
twitter: "/login/check-twitter"
login_path: /login
use_forward: false
failure_path: /login
oauth_user_provider:
service: my.oauth_aware.user_provider.service
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: ROLE_ADMIN

View File

@ -38,8 +38,8 @@ services:
class: HWI\Bundle\OAuthBundle\Security\Core\User\FOSUBUserProvider
arguments:
- '@fos_user.user_manager'
- ['pass properties as array']
- ['@fos_user.user_manager', { google: googleId , twitter: twitterId, disqus: disqusId}]
my.custom.user_provider:
class: MyBundle\Security\Core\User\MyFOSUBUserProvider
arguments: ['@fos_user.user_manager', { facebook: facebook_id }]
arguments: ['@fos_user.user_manager', { facebook: facebook_id ,twitter: twitterId, disqus: disqusId }]

0
src/AppBundle/Entity/Festival.php Executable file → Normal file
View File

0
src/AppBundle/Entity/Product.php Executable file → Normal file
View File

View File

@ -43,7 +43,7 @@ class Product {
*/
private $user;
/**
* @ORM\OneToMany(targetEntity="AppBundle\Entity\User", mappedBy="product")
* @ORM\OneToMany(targetEntity="AppBundle\Entity\ProductSold", mappedBy="product")
*/
private $productsSold;
@ -169,4 +169,44 @@ class Product {
public function getStockCount() {
return $this->stockCount;
}
/**
* Constructor
*/
public function __construct() {
$this->productsSold = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Add productsSold.
*
* @param \AppBundle\Entity\User $productsSold
*
* @return Product
*/
public function addProductsSold( \AppBundle\Entity\User $productsSold ) {
$this->productsSold[] = $productsSold;
return $this;
}
/**
* Remove productsSold.
*
* @param \AppBundle\Entity\User $productsSold
*
* @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
*/
public function removeProductsSold( \AppBundle\Entity\User $productsSold ) {
return $this->productsSold->removeElement( $productsSold );
}
/**
* Get productsSold.
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getProductsSold() {
return $this->productsSold;
}
}

0
src/AppBundle/Entity/ProductCategory.php Executable file → Normal file
View File

0
src/AppBundle/Entity/ProductSold.php Executable file → Normal file
View File

0
src/AppBundle/Entity/SellRecord.php Executable file → Normal file
View File

53
src/AppBundle/Entity/User.php Executable file → Normal file
View File

@ -21,6 +21,15 @@ class User extends BaseUser {
*/
protected $id;
/**
* @ORM\Column(name="twitter_id", type="string", length=255, nullable=true)
*/
private $twitterId;
/**
* @ORM\Column(name="disqus_id", type="string", length=255, nullable=true)
*/
private $disqusId;
/**
* @ORM\Column(name="google_id", type="string", length=255, nullable=true)
*/
@ -305,4 +314,48 @@ class User extends BaseUser {
public function getActiveFestival() {
return $this->activeFestival;
}
/**
* Set twitterId.
*
* @param string|null $twitterId
*
* @return User
*/
public function setTwitterId( $twitterId = null ) {
$this->twitterId = $twitterId;
return $this;
}
/**
* Get twitterId.
*
* @return string|null
*/
public function getTwitterId() {
return $this->twitterId;
}
/**
* Set disqusId.
*
* @param string|null $disqusId
*
* @return User
*/
public function setDisqusId( $disqusId = null ) {
$this->disqusId = $disqusId;
return $this;
}
/**
* Get disqusId.
*
* @return string|null
*/
public function getDisqusId() {
return $this->disqusId;
}
}

View File

@ -21,6 +21,15 @@ class User extends BaseUser {
*/
protected $id;
/**
* @ORM\Column(name="twitter_id", type="string", length=255, nullable=true)
*/
private $twitterId;
/**
* @ORM\Column(name="disqus_id", type="string", length=255, nullable=true)
*/
private $disqusId;
/**
* @ORM\Column(name="google_id", type="string", length=255, nullable=true)
*/