Fosuserbundle: Create commands to manipulate groups

Created on 2 Nov 2016  路  2Comments  路  Source: FriendsOfSymfony/FOSUserBundle

It would be a nice addition to be able to create groups in the command line and assign user to it.

It would see command like:

php bin/console fos:group:create {groupName}
php bin/console fos:group:addUser {groupName} {user1} [{user2} {user3} ...]
php bin/console fos:group:removeUser {groupName} {user1} [{user2} {user3} ...]
php bin/console fos:user:addGroup {user1} {group1} [{group2} {group3} ...]
php bin/console fos:user:removeGroup {user1} {group1} [{group2} {group3} ...]

I don't have much time lately, I'll see if I can post a pull request on this later this month.

Most helpful comment

I'm -1 for this, as I would rather remove groups entirely.

Using the role inheritance is better when the role inheritance is fixed.
And when access need to be managed in batch in a configurable way, using custom voters based on the business logic is more powerful than using the FOSUserBundle feature assigning extra roles from the groups the user is assigned to.

This feature is a legacy from the symfony 1 era, ported to KnpUserBundle at a time the role hierarchy was not yet implemented in Symfony 2

All 2 comments

I'm -1 for this, as I would rather remove groups entirely.

Using the role inheritance is better when the role inheritance is fixed.
And when access need to be managed in batch in a configurable way, using custom voters based on the business logic is more powerful than using the FOSUserBundle feature assigning extra roles from the groups the user is assigned to.

This feature is a legacy from the symfony 1 era, ported to KnpUserBundle at a time the role hierarchy was not yet implemented in Symfony 2

Agreed.

Was this page helpful?
0 / 5 - 0 ratings