I'm trying to secure some REST URLs that are present in my ApiController.php so that users with certain privileges can access these REST APIs. I created some users and assigned them with some Roles using the below link:
As you can see, I'm creating roles in Drupal Admin following below steps:
Drupal UI → People → Role → Add New Role // line 4
After that, I added a few permissions in permission.yml:
edit permission: title: 'edit permission'
And updated routing file to secure APIs:
xyz.update: path: '/update' _controller: 'ApiController::update' _permission: 'edit permission'
This is working fine. i.e. users that have "edit permission" can access URL "/update". But, I don't want to do step on line 4 rather I would like to use some .yaml file to create Roles.