Adonis ACL error

Hi to implement roles and permissions, i seeded roles and permissions and in the controller i am tryng to attach it to the user but i am getting ’ roleUtilisateur is not defined’ but i do created it in the seed like this :slight_smile:

const roleUtilisateur = new Role();
roleUtilisateur.name = “Utilisateur”;
roleUtilisateur.slug = “utilisateur”;
roleUtilisateur.description = “manage utilisateur privileges”;
await roleUtilisateur.save();
and here is how i am ataching it: const user = await User.create(request.only([‘username’,‘email’,‘password’]))

  await user.roles().attach([roleUtilisateur.id])

Hi!

Where you get this error? Does it provide you any file and line nr?

Hi
I am getting the error when trying to attach the Utilisateur role using the code bellow and tha error gotten is:

roleUtilisateur is not defined

await user.roles().attach([roleUtilisateur.id])