From 627a1de48f9be4145239f61097dede71e12fc460 Mon Sep 17 00:00:00 2001 From: Kayn Ty Date: Wed, 25 Apr 2018 14:47:31 +0200 Subject: [PATCH] properties for user oauth --- app/config/config.yml | 21 ++++++---- app/config/routing.yml | 12 +++--- app/config/security.yml | 34 +++++++-------- app/config/services.yml | 4 +- src/AppBundle/Entity/Festival.php | 0 src/AppBundle/Entity/Product.php | 0 src/AppBundle/Entity/Product.php~ | 42 ++++++++++++++++++- src/AppBundle/Entity/ProductCategory.php | 0 src/AppBundle/Entity/ProductSold.php | 0 src/AppBundle/Entity/SellRecord.php | 0 src/AppBundle/Entity/User.php | 53 ++++++++++++++++++++++++ src/AppBundle/Entity/User.php~ | 9 ++++ 12 files changed, 141 insertions(+), 34 deletions(-) mode change 100755 => 100644 src/AppBundle/Entity/Festival.php mode change 100755 => 100644 src/AppBundle/Entity/Product.php mode change 100755 => 100644 src/AppBundle/Entity/ProductCategory.php mode change 100755 => 100644 src/AppBundle/Entity/ProductSold.php mode change 100755 => 100644 src/AppBundle/Entity/SellRecord.php mode change 100755 => 100644 src/AppBundle/Entity/User.php diff --git a/app/config/config.yml b/app/config/config.yml index 98217576..a7f156f4 100755 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -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 diff --git a/app/config/routing.yml b/app/config/routing.yml index 77ddbb36..3391f671 100755 --- a/app/config/routing.yml +++ b/app/config/routing.yml @@ -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 diff --git a/app/config/security.yml b/app/config/security.yml index c6a9a960..8df00726 100755 --- a/app/config/security.yml +++ b/app/config/security.yml @@ -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 diff --git a/app/config/services.yml b/app/config/services.yml index fe6d3d5a..fb8671ac 100755 --- a/app/config/services.yml +++ b/app/config/services.yml @@ -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 }] diff --git a/src/AppBundle/Entity/Festival.php b/src/AppBundle/Entity/Festival.php old mode 100755 new mode 100644 diff --git a/src/AppBundle/Entity/Product.php b/src/AppBundle/Entity/Product.php old mode 100755 new mode 100644 diff --git a/src/AppBundle/Entity/Product.php~ b/src/AppBundle/Entity/Product.php~ index bf1570e9..bdfba8c0 100755 --- a/src/AppBundle/Entity/Product.php~ +++ b/src/AppBundle/Entity/Product.php~ @@ -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; + } } diff --git a/src/AppBundle/Entity/ProductCategory.php b/src/AppBundle/Entity/ProductCategory.php old mode 100755 new mode 100644 diff --git a/src/AppBundle/Entity/ProductSold.php b/src/AppBundle/Entity/ProductSold.php old mode 100755 new mode 100644 diff --git a/src/AppBundle/Entity/SellRecord.php b/src/AppBundle/Entity/SellRecord.php old mode 100755 new mode 100644 diff --git a/src/AppBundle/Entity/User.php b/src/AppBundle/Entity/User.php old mode 100755 new mode 100644 index 9eef808f..c20a8b62 --- a/src/AppBundle/Entity/User.php +++ b/src/AppBundle/Entity/User.php @@ -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; + } } diff --git a/src/AppBundle/Entity/User.php~ b/src/AppBundle/Entity/User.php~ index 9eef808f..d37354c3 100755 --- a/src/AppBundle/Entity/User.php~ +++ b/src/AppBundle/Entity/User.php~ @@ -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) */