2021-09-07 09:45:45 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
module.exports = [
|
|
|
|
{
|
|
|
|
method: 'GET',
|
|
|
|
path: '/roles/:id',
|
2022-03-03 22:55:29 +09:00
|
|
|
handler: 'role.findOne',
|
2021-09-07 09:45:45 +02:00
|
|
|
config: {
|
|
|
|
policies: [
|
|
|
|
{
|
|
|
|
name: 'admin::hasPermissions',
|
2021-10-04 18:16:28 +02:00
|
|
|
config: {
|
2021-09-07 09:45:45 +02:00
|
|
|
actions: ['plugin::users-permissions.roles.read'],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
method: 'GET',
|
|
|
|
path: '/roles',
|
2022-03-03 22:55:29 +09:00
|
|
|
handler: 'role.find',
|
2021-09-07 09:45:45 +02:00
|
|
|
config: {
|
|
|
|
policies: [
|
|
|
|
{
|
|
|
|
name: 'admin::hasPermissions',
|
2021-10-04 18:16:28 +02:00
|
|
|
config: {
|
2021-09-07 09:45:45 +02:00
|
|
|
actions: ['plugin::users-permissions.roles.read'],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
method: 'POST',
|
|
|
|
path: '/roles',
|
|
|
|
handler: 'role.createRole',
|
|
|
|
config: {
|
|
|
|
policies: [
|
|
|
|
{
|
|
|
|
name: 'admin::hasPermissions',
|
2021-10-04 18:16:28 +02:00
|
|
|
config: {
|
2021-09-07 09:45:45 +02:00
|
|
|
actions: ['plugin::users-permissions.roles.create'],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
method: 'PUT',
|
|
|
|
path: '/roles/:role',
|
|
|
|
handler: 'role.updateRole',
|
|
|
|
config: {
|
|
|
|
policies: [
|
|
|
|
{
|
|
|
|
name: 'admin::hasPermissions',
|
2021-10-04 18:16:28 +02:00
|
|
|
config: {
|
2021-09-07 09:45:45 +02:00
|
|
|
actions: ['plugin::users-permissions.roles.update'],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
method: 'DELETE',
|
|
|
|
path: '/roles/:role',
|
|
|
|
handler: 'role.deleteRole',
|
|
|
|
config: {
|
|
|
|
policies: [
|
|
|
|
{
|
|
|
|
name: 'admin::hasPermissions',
|
2021-10-04 18:16:28 +02:00
|
|
|
config: {
|
2021-09-07 09:45:45 +02:00
|
|
|
actions: ['plugin::users-permissions.roles.delete'],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
];
|