aerni / statamic-factory

Easily whip up fake content using Faker
https://statamic.com/addons/aerni/factory
MIT License
18 stars 4 forks source link

Add support for generating users #25

Open montemartin opened 2 months ago

montemartin commented 2 months ago

I've finally gotten around to trying this out, (thanks for getting the install issue fixed!)

For my current project I've already got a decent amount of most content types, but I was surprised there isn't a way to generate user profiles (unless I missed something). I have an number of roles and groups to test and creating users for each is a pain. Would be great to have a way to generate generic users.

As quick hack I created a user-factory collection. It does most of what I need but still requires copying the email address into the file name and moving files to the users folder. It would be great to have a default way to do this.

As an added bonus it would be helpful if we could tell the factory to generate a single user for each role and/or group configured for the site. Ideally it would set the name and email based on the title of the role/group. (e.g. name: "Role Group" email: "role.group@example.com") That would make it easier to find the correct file or profile to test for each set of permissions.

I know you're already at work on a refactor. I'm happy to take a stab at a PR if it would be helpful, but I've already met my own needs so figured this might be something to handle after that's done.

aerni commented 2 months ago

I'll add this to my list of feature requests and see how this can be implemented in the refactored version.