backend/app/routing/routers/api/v1/sharing.routes.js

47 lines
1.4 KiB
JavaScript

/*
* API v1 Routes
* -------------------------------------------------------------
* Description here
*/
const index = {
prefix: '/api/v1/share',
middleware: [
'auth:UserOnly',
],
get: {
'/page/:PageId/info': [
['middleware::api:RequiredFields', { form: 'sharing.page' }],
['middleware::api:PageRoute', {level: 'manage'}],
'controller::api:v1:Sharing.page_info',
],
'/page/:PageId/link/:level': [
['middleware::api:RequiredFields', { form: 'sharing.page_link'}],
['middleware::api:PageRoute', {level: 'manage'}],
'controller::api:v1:Sharing.get_link',
],
},
post: {
// Share a page with the specified user.
'/page/:PageId/share': [
['middleware::api:RequiredFields', { form: 'sharing.page_level' }],
['middleware::api:PageRoute', {level: 'manage'}],
'middleware::api:UserRoute',
'controller::api:v1:Sharing.share_page',
],
// Unshare a page with the specified user.
'/page/:PageId/revoke': [
['middleware::api:RequiredFields', { form: 'sharing.page_user' }],
['middleware::api:PageRoute', {level: 'manage'}],
'middleware::api:UserRoute',
'controller::api:v1:Sharing.revoke_page',
],
},
}
module.exports = exports = index