Replace standard groups


#1

In Sprinkle\Account\Database\Migrations\v400\GroupsTable three groups are defined.
I would like to replace to use a different set of groups.

I’m not clear how to replace the data and add project-specific default values.


#2

Can’t you add a migration for (one of) your own Sprinkle(s) that does this for you? To be safe I would also add a down() method in case a rollback is required. Using the dependencies you can be sure the table exists.

public $dependencies = [
    '\UserFrosting\Sprinkle\Account\Database\Migrations\v400\PermissionsTable',
    '\UserFrosting\Sprinkle\Account\Database\Migrations\v400\RolesTable'
];

#3

Yes, I can add the GroupsTable and delete the existing entries that way and add my own.
Since UserFrosting comes with hard coded groups I was wondering if there was another way.


#4

I see, changing them completely will indeed be a challenge…


#5

Thing is, for new user, it makes sense to create the default groups on first setup so they have a working env. Same for permissions and Roles. That’s the reason they are “hardcoded”. Which means, your solution to delete and create your own group in your migration is the way to go.

In the next version of UF, default data could be handled by the new seeds command. I guess we could make it so you can overwrite a seed…

If you guys have another idea on how we should handle default data such as groups, permissions and roles, let us know. It’s something that does need improvement.