AuthorizedSubResource extends AuthorizedResource
rest-io
supports Authorized Resources. The UserResource is mandatory to enable authorized resources.
To create an Authorized Parent Resource:
import { AuthorizedResource } from 'rest-io';
export const blog = new AuthorizedResource({
name: 'blog',
model: {
title: String,
posts: [{
message: String
}]
}
});
To create a sub resource for the posts:
import { AuthorizedSubResource } from 'rest-io';
import blog from './blog';
export const posts = new AuthorizedSubResource({
name: 'post',
parentResource: blog
});
The Authorized Sub Resource allows you to easily configure per method what roles have access to them.
Returns a projection query object. Used during getting a single sub resource.
Returns a $pull query object. Used during deleting a sub resource.
Returns a query to single out the sub resource within it's parent. Used during updating a sub resource.
Returns a $set query object. Used during updating a sub resource.