fosuserbundle

Symfony 2 FOS UserBundle users doesn't get group's role

允我心安 提交于 2019-12-21 05:39:12
问题 I'm using FOS User Bundle to manage access to my app. As i need a group notion, i've implemented what i need as described in the doc group . Everything's fine for creating users and groups BUT when i'm logging in with a user, and trying to get his role, he has none but USER_ROLE. Here is my User use FOS\UserBundle\Entity\User as BaseUser; class RegistredUser extends BaseUser { /** * @ORM\Id * @ORM\Column(type="integer") * @ORM\GeneratedValue(strategy="AUTO") */ protected $id; /** * @ORM

FOSUserBundle group role setup

非 Y 不嫁゛ 提交于 2019-12-21 01:44:38
问题 I am using the FOSUserBundle and the Group option. Registration works. Creation of groups works too. If I create 2 groups, admin and client and MANUALLY add a:1:{i:0;s:10:"ROLE_ADMIN";} to the admin group in the fos_group table and then MANULLY setup and entry in the fos_user_user_group that ties an user to the admin group, logging in with that user will be able to log in as an admin. However, there are, obviously, some disadvantages to this method. What can I use to add an user to a group

FOSUserBundle multiple user types

梦想的初衷 提交于 2019-12-20 20:39:17
问题 I am building an application where I have (at least) two different user types, let's say buyers and sellers. Each user type should have its own logic (registration form/process, profile, rights, ...) but I would like to use FOSUserBundle with each user, in order to have a common management on some points. I am actually blocked by registration forms ; it happens that I can't declare different forms into FOSUserBundle, and after some research it seems to be impossible. Some answers that I found

Call a method after user Login

北战南征 提交于 2019-12-20 10:47:11
问题 I was wondering if there is away to call a function after the user login. Here is the code I want to call: $point = $this->container->get('process_points'); $point->ProcessPoints(1 , $this->container); 回答1: You can find the events FOSUserBundle fires in the FOSUserEvents class. More specifically, this is the one you are looking for: /** * The SECURITY_IMPLICIT_LOGIN event occurs when the user is logged in programmatically. * * This event allows you to access the response which will be sent. *

fosuserbundle override login action

南笙酒味 提交于 2019-12-19 07:11:28
问题 I am using FSOUserBundle and I want to override loginAction, I used this method: namespace PjDZ\UserBundle\Controller; use FOS\UserBundle\Controller\SecurityController as BaseController; class SecurityController extends BaseController { public function loginAction(\Symfony\Component\HttpFoundation\Request $request) { /** @var $session \Symfony\Component\HttpFoundation\Session\Session */ $session = $request->getSession(); // get the error if any (works with forward and redirect -- see below)

FosUserbundle and symfony 2 template and edits

血红的双手。 提交于 2019-12-19 04:42:28
问题 I am new to symfony 2. I have just setup with basic FOSuserbundle. But I have a few problems: I have setup the new layout template but I could not find where to change the form template for login, registration, profile I could not find how to edit the user profile. I can view the profile using /profile but I could not find any edit link there 回答1: Answers on your questions you can find inside documentation. Here are some points: Copy templates you want to modify from FOSUserBundle/Resources

show/hide some menus depend on the Sonata admin ROLE

依然范特西╮ 提交于 2019-12-19 04:04:09
问题 I'm working on a web project using Symfony2 , and i used Sonata Admin for the admin Panel , every thing works fine but what i want to do is ,on the dashboard menus of sonata Admin , i need to show hide some menus depend on the admin ROLE , so did any one do this before or know how to do it ? i tryed to use the config of the roles but when i'm connecting with a ROlE diffrent of ROLE_SONATA_ADMIN the top menu dont show up , - { path: ^/admin, role: [ROLE_ADMIN, ROLE_SONATA_ADMIN,ROLE_ADMIN_NEWS

FOSUserBundle AJAX Login with Symfony2 (routing)

眉间皱痕 提交于 2019-12-18 17:26:49
问题 I'm trying to make the AJAX authentication work with FOSUserBundle. I have created an Handler directory with a AuthenticationHandler class : <?php namespace BirdOffice\UserBundle\Handler; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\Routing\RouterInterface; use Symfony\Component\HttpFoundation\Session\Session; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security

Use FOSUserBundle in relation with yml-based Entities

巧了我就是萌 提交于 2019-12-18 16:58:32
问题 I've started a Symfony2 project from scratch where I then installed FOSUserBundle . Then, I have written (actually, generated with ORM Designer) some entities that need to have relations between them, and with the User entity. I have Items belonging to Users , Collections belonging to Users that group Items , and so on. Since I used FOSUserBundle I only have a basic User class (https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/doc/index.md , step 3a) defined using

Symfony2 FOSUserBundle – Validate against “user active” flag on login

我是研究僧i 提交于 2019-12-18 13:36:03
问题 I have a flag on my users for 'active' and if set to zero or null, I will not allow login. I have tried a couple of approaches and come up short. If I do the logout route the flash message is not preserved, so the user sees nothing. I looked into adding a validation on the login form so that it would throw a normal form error if the flag was not set to true, but in that folder (vendor/Bundles/FOS/UserBundle/Form/Type) I find nothing for login form, only registration and such, so I wouldn't