Adonis-acl help

Don’t know where put this code:

const createUsersPermission = new Permission()
createUsersPermission.slug = 'create_users'
createUsersPermission.name = 'Create Users'
createUsersPermission.description = 'create users permission'
await createUsersPermission.save()

const updateUsersPermission = new Permission()
updateUsersPermission.slug = 'update_users'
updateUsersPermission.name = 'Update Users'
updateUsersPermission.description = 'update users permission'
await updateUsersPermission.save()

Maybe need to create separate ace command like seeds for creating roles and premissions

I’d probably just go ahead and do it with a seed file. Since you are basically just seeding the DB with these anyway, that makes sense to do with a seed to me.

adonis make:seed UserPermissions

Put your code in the run method in the resulting file.

1 Like

who make Relationships between user and permissions using seeds?