Added more structure and tests to our authorization code

This commit is contained in:
Tom Moor
2018-02-18 00:11:48 -08:00
parent b53749c95c
commit 2f81eb5e87
9 changed files with 138 additions and 19 deletions

View File

@ -0,0 +1,13 @@
// @flow
import policy from './policy';
import Document from '../models/Document';
import User from '../models/User';
const { allow } = policy;
allow(
User,
['create', 'read', 'update', 'delete'],
Document,
(user, doc) => user.teamId === doc.teamId
);