Is there any API available to create Strapi Admin users with different roles?
As far as I know, it is not due to security issues.
1 Like
As it is pointed somewhere(i can’t remember it), for security reasons, it must not be possible.
Hey @Sarath_CM,
I guess you are looking for something like this:
await strapi.db.query("admin::role").create({
name: "Super Admin",
code: "strapi-super-admin",
description:
"Super Admins can access and manage all features and settings.",
});
After that just edit the roles-array of your admin-user (“admin::user”).
If you’ve trouble adapting that maybe have a look into my strapi-plugin to easily create a default admin on startup of strapi:
1 Like
you don’t need to add the user info to create this new user wit admin role? where do you add name, lastname, email, password and all this info that Strapi riquires in a form to access to the panel?