How to create programmatically new roles and add restrictions in strapi required help

@hashirnouman First You need to understand how Strapi users-permissions plugin works
If you look into you db you will see following tables

  1. up_permissions
  2. up_permissions_role_links
  3. up_roles

roles and permissions of user is managed using these tables and you can create custom api and perfrom curd on above tables to add new roles programmatically
you can acess table like

        strapi.db.connection
          .table('up_roles')

strapi use KNEX ORM under the table so you can read KNEX Documentation for better understanding