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

Update: I found out these were the permissions that existed against a user role and that you have to create a new entry into “plugin::users-permissions.permission” and assign that new permission to a role.


Quick question to anyone. Howcome i see multiple of the same actions in permissions and how do i know which one to use?

Query:

await strapi.entityService.findMany("plugin::users-permissions.permission");

Summarized Response:

    {
      "id": 166,
      "action": "api::auth.auth.logout",
      "createdAt": "2023-10-30T06:18:03.788Z",
      "updatedAt": "2023-10-30T06:18:03.788Z"
    },
    {
      "id": 343,
      "action": "api::auth.auth.logout",
      "createdAt": "2024-03-20T15:09:18.185Z",
      "updatedAt": "2024-03-20T15:09:18.185Z"
    },
    {
      "id": 207,
      "action": "api::auth.auth.logout",
      "createdAt": "2023-10-31T07:49:33.623Z",
      "updatedAt": "2023-10-31T07:49:33.623Z"
    },
    {
      "id": 224,
      "action": "api::auth.auth.logout",
      "createdAt": "2023-12-07T05:23:29.123Z",
      "updatedAt": "2023-12-07T05:23:29.123Z"
    },