How did you assign permissions to a Editor role from the code

stumbled upon a snippet earlier this day which sets permissions, locales and other stuff at bootstrap-time. https://github.com/strapi/strapi/issues/10466
maybe this helps you a little bit.