2021-09-08 16:16:16 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
module.exports = [
|
|
|
|
{
|
|
|
|
method: 'GET',
|
|
|
|
path: '/roles/:id/permissions',
|
|
|
|
handler: 'role.getPermissions',
|
|
|
|
config: {
|
|
|
|
policies: [
|
|
|
|
'admin::isAuthenticatedAdmin',
|
2021-10-04 18:16:28 +02:00
|
|
|
{ name: 'admin::hasPermissions', config: { actions: ['admin::roles.read'] } },
|
2021-09-08 16:16:16 +02:00
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
method: 'PUT',
|
|
|
|
path: '/roles/:id/permissions',
|
|
|
|
handler: 'role.updatePermissions',
|
|
|
|
config: {
|
|
|
|
policies: [
|
|
|
|
'admin::isAuthenticatedAdmin',
|
2021-10-04 18:16:28 +02:00
|
|
|
{ name: 'admin::hasPermissions', config: { actions: ['admin::roles.update'] } },
|
2021-09-08 16:16:16 +02:00
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
method: 'GET',
|
|
|
|
path: '/roles/:id',
|
|
|
|
handler: 'role.findOne',
|
|
|
|
config: {
|
|
|
|
policies: [
|
|
|
|
'admin::isAuthenticatedAdmin',
|
2021-10-04 18:16:28 +02:00
|
|
|
{ name: 'admin::hasPermissions', config: { actions: ['admin::roles.read'] } },
|
2021-09-08 16:16:16 +02:00
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
method: 'GET',
|
|
|
|
path: '/roles',
|
|
|
|
handler: 'role.findAll',
|
|
|
|
config: {
|
|
|
|
policies: [
|
|
|
|
'admin::isAuthenticatedAdmin',
|
2021-10-04 18:16:28 +02:00
|
|
|
{ name: 'admin::hasPermissions', config: { actions: ['admin::roles.read'] } },
|
2021-09-08 16:16:16 +02:00
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2023-03-06 21:46:45 +01:00
|
|
|
{
|
|
|
|
method: 'POST',
|
|
|
|
path: '/roles',
|
|
|
|
handler: 'role.create',
|
|
|
|
config: {
|
|
|
|
policies: [
|
|
|
|
'admin::isAuthenticatedAdmin',
|
|
|
|
{
|
|
|
|
name: 'admin::hasPermissions',
|
|
|
|
config: {
|
|
|
|
actions: ['admin::roles.create'],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2021-09-08 16:16:16 +02:00
|
|
|
{
|
|
|
|
method: 'PUT',
|
|
|
|
path: '/roles/:id',
|
|
|
|
handler: 'role.update',
|
|
|
|
config: {
|
|
|
|
policies: [
|
|
|
|
'admin::isAuthenticatedAdmin',
|
2021-10-04 18:16:28 +02:00
|
|
|
{ name: 'admin::hasPermissions', config: { actions: ['admin::roles.update'] } },
|
2021-09-08 16:16:16 +02:00
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2023-03-06 21:46:45 +01:00
|
|
|
{
|
|
|
|
method: 'DELETE',
|
|
|
|
path: '/roles/:id',
|
|
|
|
handler: 'role.deleteOne',
|
|
|
|
config: {
|
|
|
|
policies: [
|
|
|
|
'admin::isAuthenticatedAdmin',
|
|
|
|
{
|
|
|
|
name: 'admin::hasPermissions',
|
|
|
|
config: {
|
|
|
|
actions: ['admin::roles.delete'],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
method: 'POST',
|
|
|
|
path: '/roles/batch-delete',
|
|
|
|
handler: 'role.deleteMany',
|
|
|
|
config: {
|
|
|
|
policies: [
|
|
|
|
'admin::isAuthenticatedAdmin',
|
|
|
|
{
|
|
|
|
name: 'admin::hasPermissions',
|
|
|
|
config: {
|
|
|
|
actions: ['admin::roles.delete'],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2021-09-08 16:16:16 +02:00
|
|
|
];
|