2020-02-14 06:11:16 +00:00
|
|
|
/*
|
|
|
|
* API v1 Routes
|
|
|
|
* -------------------------------------------------------------
|
|
|
|
* Description here
|
|
|
|
*/
|
|
|
|
const index = {
|
|
|
|
|
|
|
|
prefix: '/api/v1/share',
|
|
|
|
|
|
|
|
get: {
|
|
|
|
'/page/:PageId/info': [
|
2021-03-04 17:26:14 +00:00
|
|
|
'middleware::auth:UserOnly',
|
2020-02-14 06:11:16 +00:00
|
|
|
['middleware::api:RequiredFields', { form: 'sharing.page' }],
|
|
|
|
['middleware::api:PageRoute', {level: 'manage'}],
|
|
|
|
'controller::api:v1:Sharing.page_info',
|
|
|
|
],
|
|
|
|
'/page/:PageId/link/:level': [
|
2021-03-04 17:26:14 +00:00
|
|
|
'middleware::auth:UserOnly',
|
2020-02-14 06:11:16 +00:00
|
|
|
['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': [
|
2021-03-04 17:26:14 +00:00
|
|
|
'middleware::auth:UserOnly',
|
2020-02-14 06:11:16 +00:00
|
|
|
['middleware::api:RequiredFields', { form: 'sharing.page_level' }],
|
|
|
|
['middleware::api:PageRoute', {level: 'manage'}],
|
2021-03-04 17:26:14 +00:00
|
|
|
['middleware::api:UserRoute', { allow_public_user: true }],
|
2020-02-14 06:11:16 +00:00
|
|
|
'controller::api:v1:Sharing.share_page',
|
|
|
|
],
|
|
|
|
|
|
|
|
// Unshare a page with the specified user.
|
|
|
|
'/page/:PageId/revoke': [
|
2021-03-04 17:26:14 +00:00
|
|
|
'middleware::auth:UserOnly',
|
2020-02-14 06:11:16 +00:00
|
|
|
['middleware::api:RequiredFields', { form: 'sharing.page_user' }],
|
|
|
|
['middleware::api:PageRoute', {level: 'manage'}],
|
2021-03-04 17:26:14 +00:00
|
|
|
['middleware::api:UserRoute', { allow_public_user: true }],
|
2020-02-14 06:11:16 +00:00
|
|
|
'controller::api:v1:Sharing.revoke_page',
|
|
|
|
],
|
2021-03-04 17:26:14 +00:00
|
|
|
|
|
|
|
// Check the public user's access to a given resource
|
|
|
|
'/check': [
|
|
|
|
['middleware::api:RequiredFields', { form: 'sharing.permission_check'}],
|
|
|
|
['middleware::auth:ApiRoute', { allow_public: true }],
|
|
|
|
'controller::api:v1:Sharing.permission_check',
|
|
|
|
],
|
|
|
|
|
|
|
|
// Check the public user's access to a given page
|
|
|
|
'/check-page/:PageId/:level': [
|
|
|
|
['middleware::auth:ApiRoute', { allow_public: true }],
|
|
|
|
'controller::api:v1:Sharing.permission_check_page',
|
|
|
|
],
|
2020-02-14 06:11:16 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = exports = index
|