Symfony2 user manager bundles? - symfony

Which are the best user manager bundles for Symfony 2 and why?
I only know FOSUserBundle.
Are there other good bundles for managing users?
(like it was sfDoctrineGuardPlugin for Symfony 1)
I need not a final, closed solution, but the pros and contras for someone to be able to choose the best bundle depending on his needs.

Firstly, i wrote an UserBundle implementation for my requirements, after i discovered FOSUserBundle and i learned best practices from it.
I think FosUserBundle is a good choice for user manager in Symfony 2. Because
Actively maintained and supported
Provides command line commands for creating new user, activating, promoting etc.
Built-in forms, controllers and views for user related actions.
Supports Doctrine, Propel, CouchDB and Mongo for persistance.
Localization, translations
Optional features like email activation
Supported by other bundles like Sonata bundles
I never worked with other UserBundle, but i highly recommend to use FOSUserBundle.

Related

advance admin generator symfony2

At the company where I'm working we want to create a complex admin for a new project. We have the following requirements:
Should restrict the list of objects an user has access.
Have a log of changes to the entities.
Permisions based on role of user and group he belongs (think for goup as organization). The user can manage entities that are created by users of the same organization. When a entity is created, a owner is assigned.
RESTfull
We considered SonataAdmin, EasyAdmin or creating an admin with SyliusResourceBundle and SyliusGridBundle.
The questions for SonataAdmin and EesyAdmin are if it is easy to manage permissions based on roles and the organization the user belongs to. Also, we are not sure if it will be complex to made it able to make it RESTfull.
Our questions regarding to SyliusResourceBundle and SyliusGridBundle are if it is too complex to create an admin generator with this two components. On the other hand we think it is more flexible on configuring to use custom managers (to envolve the repositories) in SyliusResourceBundle then SonataAdmin and EasyAdmin. Is that true?
What do you thing of this options? Are there other options?
I can only answer the first of your questions. Will be not easy to implement this future on EasyAdmin and as it's owner say to me:
"If this feature is essential to your backend, I recommend you to use
SonataAdminBundle instead"
This are some post when you can find some clues about how to do it here, here and here. You can see the intention of it's owner to develop this feature in the near future,but not ready yet, so Sonata still remain as the best option. The problem with sonata is that still isn't fully compatible with symfony3 in an stable version, so it's only recommended with symfony 2.7.
Hope this information help you.

Migration from Propel to Propel2

I want to migrate a Symfony2 project (v.2.7.1) from Propel1.7 to Propel2 (currently "alpha 5").
I'm using various Propel behaviors and third party bundles which relies on "Propel" adaptators to correctly work. It will be very helpful for me to have your comments for each behavior / bundle to know if it's trivial to migrate or if difficulties (and which!) could happen...
Behaviors:
Archivable
NestedSet
Sluggable
QueryCache
Timestampable
Typehintable (willdurand/propel-typehintable-behavior)
Equalnest (craftyshadow/propel-equalnest-behavior)
Geocodable (willdurand/geocoder-bundle)
Third party bundles:
FOSUserBundle
GlorpenPropelBundle
FOSElasticaBundle
Core behaviors
Theses behaviors are still in Propel2
Archivable
NestedSet
Sluggable
QueryCache
Timestampable
Third-party behaviors
Equalnest
The author does not seem confident in the compatibility like explained in this issue. I'll create a specific issue #969 to know the state of the art for managing an "equal nest" in Propel2.
Geocodable
A PR has been done here, but no news for a long time...
There is now a dedicated repo for Propel2.
Core source
The typehintable is in the core of Propel2, so it smells good
Third-party bundles
FOSUserBundle
Propel2 integration is related to that issue; as the typehintable behavior is now in the Propel core, I suppose we have to change the schema.xml supplied by default by FOSUserBundle for Propel.
GlorpenPropelBundle
It seems not compatible for the moment as explained here, but I suppose it would be better to discuss all the subjects covered in this fantastic bundle in a dedicated issue to know how Propel2 manage these problematics.
FosElasticaBundle
Even for Propel1, this bundle was a little bit hard to use, I suppose we have to work for Propel2.
Full links & discussion on github / https://github.com/propelorm/Propel2/issues/966

LDAP integration in Symfony2

I'm new to symfony & LDAP. Is there any step by step tutorial or videos to integrate LDAP in symfony2?
I don't know any tutorial or video about LDAP in Symfony2 but here are 2 bundles I used in many projects:
OpenSkyLdapBundle (requires ZF2 LDAP component)
FR3DLdapBundle (integration with FOSUserBundle)
Newer versions of Symfony2 should have LDAP support already in there. If you are constrained to an older version, consider using DapsBundle, since its functionality is patterned after Symfony2's upgrade path, meaning it should be easier for you when you do upgrade your Symfony2 version.. You can learn more about on my blog at http://robertelwell.info/blog/daps-ldap-symfony2/.
FOSUserBundle is a bundle for authenticate users against a DB, if you don't want manager your users with the DB then you must do a little customizations for break the dependency in FR3DLdapBundle.
Writing your own UserManager and setting it in the configuration should be enough.
The UserManager is used for create the User instance the first time.

Headache designing Symfony2 bundles organization

I'm developing a SaaS where tenants are both real ones and admins (us). So "fornt-end" and "back-end" are the same. Anyway, according to many other questions bundles are a way to structure your project in reusable way.
I really don't think that our bundles are going to be reused, but i still need a way to split the project into bundles to quickly find files we want to work on. Application should:
CRUD for customers - tenants should be able to manage their
customers/partnerships
CRUD for customers tags and keywords (a way to categorize their customers)
CRUD for broadcast notifications sent by us (a messaging system)
CRUD for tenants - we should be able to manage our tenants
So, how can organize my bundles? Could be:
CoreBundle: only Doctrine2 models
ResourcesBundle: templates, js, css, images
SystemUserBundle: manage tenants and customers CRUD
MessagingBundle: message system
How this design can be improved?
According to the Symfony2 documentation:
In Symfony2, a bundle is like a plugin, except that all of the code in
your application will live inside a bundle. A bundle is nothing more
than a directory that houses everything related to a specific feature,
including PHP classes, configuration, and even stylesheets and
Javascript files (see The Bundle System).
Personally, following this description, I would set up the SystemUserBundle to contain the Doctrine2 model and templates/js/css/images that specifically relate to managing customers, rather than splitting them out into CoreBundle and ResourceBundle. However, splitting your app into SystemUserBundle and MessagingBundle sounds like a reasonable approach.
I like to think of it this way - does the bundle encapsulate some behaviour that I might need or want to plugin to a future Symfony project(s) I am involved in. Customer Management, for example, is something that might apply to any app and be re-used across projects (indeed, this is why the extensible FOSUserBundle exists).
I don't think the Symfony2 docs go into sufficient detail on bundles (yet!) but in case you haven't found all the relevant sections these are the ones I'm aware of:
Symfony 2 Page creation
Symfony 2 The Bundle System
Symfony 2 Bundles best practices

Symfony2 FOSUserBundle Role entities

I'm currently trying to figure out the best way to implement doctrine persisted Role entities as a M2M relationship compatible with FOSUserBundle. Previously I was using just strings with the default implementation and was persisting it with a doctrine array mapping.
Now I need to have roles as seperate entites as we want to build an admin backend where others can grant users roles.
Basically, it's a pain in the ass. The FOS interfaces are built for string representations, not Role entities. Change the implementation, you break a lot of stuff i.e. FOS commands to promote users. And it's hard to figure out exactly which pieces of the interfaces are needed to allow the symfony2 security system to continue working correctly.
I could rewrite the role management code and use Role entities as much as possible, e.g.:
$user->addRole(new Role('ROLE_FOO'));
But that breaks commands and possibly existing code?
Or continue using:
$user->addRole('ROLE_FOO');
And couple role/entity manager code in addRole() (bad design).
I've noticed this is a grey area (Role entities with FOS) and has been mentioned on the symfony2 boards and round here, but no decent solutions.
Anyone had any experience or can think of a decent solution?
I decided to go with a mix of an array/ArrayCollection implementation. I tried to follow the existing interfaces as much as possible so as not to break the security system. I have documented my solution at http://blog.jmoz.co.uk/symfony2-fosuserbundle-role-entities

Resources